diff --git a/api/slinky/marketmap/v1/market.pulsar.go b/api/slinky/marketmap/v1/market.pulsar.go index 912db7654..c9768213c 100644 --- a/api/slinky/marketmap/v1/market.pulsar.go +++ b/api/slinky/marketmap/v1/market.pulsar.go @@ -15,34 +15,79 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_Market_2_list)(nil) + +type _Market_2_list struct { + list *[]*ProviderConfig +} + +func (x *_Market_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Market_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_Market_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*ProviderConfig) + (*x.list)[i] = concreteValue +} + +func (x *_Market_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*ProviderConfig) + *x.list = append(*x.list, concreteValue) +} + +func (x *_Market_2_list) AppendMutable() protoreflect.Value { + v := new(ProviderConfig) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Market_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_Market_2_list) NewElement() protoreflect.Value { + v := new(ProviderConfig) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_Market_2_list) IsValid() bool { + return x.list != nil +} + var ( - md_Ticker protoreflect.MessageDescriptor - fd_Ticker_currency_pair protoreflect.FieldDescriptor - fd_Ticker_decimals protoreflect.FieldDescriptor - fd_Ticker_min_provider_count protoreflect.FieldDescriptor - fd_Ticker_enabled protoreflect.FieldDescriptor - fd_Ticker_metadata_JSON protoreflect.FieldDescriptor + md_Market protoreflect.MessageDescriptor + fd_Market_ticker protoreflect.FieldDescriptor + fd_Market_provider_configs protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_market_proto_init() - md_Ticker = File_slinky_marketmap_v1_market_proto.Messages().ByName("Ticker") - fd_Ticker_currency_pair = md_Ticker.Fields().ByName("currency_pair") - fd_Ticker_decimals = md_Ticker.Fields().ByName("decimals") - fd_Ticker_min_provider_count = md_Ticker.Fields().ByName("min_provider_count") - fd_Ticker_enabled = md_Ticker.Fields().ByName("enabled") - fd_Ticker_metadata_JSON = md_Ticker.Fields().ByName("metadata_JSON") + md_Market = File_slinky_marketmap_v1_market_proto.Messages().ByName("Market") + fd_Market_ticker = md_Market.Fields().ByName("ticker") + fd_Market_provider_configs = md_Market.Fields().ByName("provider_configs") } -var _ protoreflect.Message = (*fastReflection_Ticker)(nil) +var _ protoreflect.Message = (*fastReflection_Market)(nil) -type fastReflection_Ticker Ticker +type fastReflection_Market Market -func (x *Ticker) ProtoReflect() protoreflect.Message { - return (*fastReflection_Ticker)(x) +func (x *Market) ProtoReflect() protoreflect.Message { + return (*fastReflection_Market)(x) } -func (x *Ticker) slowProtoReflect() protoreflect.Message { +func (x *Market) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_market_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -54,43 +99,43 @@ func (x *Ticker) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_Ticker_messageType fastReflection_Ticker_messageType -var _ protoreflect.MessageType = fastReflection_Ticker_messageType{} +var _fastReflection_Market_messageType fastReflection_Market_messageType +var _ protoreflect.MessageType = fastReflection_Market_messageType{} -type fastReflection_Ticker_messageType struct{} +type fastReflection_Market_messageType struct{} -func (x fastReflection_Ticker_messageType) Zero() protoreflect.Message { - return (*fastReflection_Ticker)(nil) +func (x fastReflection_Market_messageType) Zero() protoreflect.Message { + return (*fastReflection_Market)(nil) } -func (x fastReflection_Ticker_messageType) New() protoreflect.Message { - return new(fastReflection_Ticker) +func (x fastReflection_Market_messageType) New() protoreflect.Message { + return new(fastReflection_Market) } -func (x fastReflection_Ticker_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Ticker +func (x fastReflection_Market_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Market } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_Ticker) Descriptor() protoreflect.MessageDescriptor { - return md_Ticker +func (x *fastReflection_Market) Descriptor() protoreflect.MessageDescriptor { + return md_Market } // 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_Ticker) Type() protoreflect.MessageType { - return _fastReflection_Ticker_messageType +func (x *fastReflection_Market) Type() protoreflect.MessageType { + return _fastReflection_Market_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_Ticker) New() protoreflect.Message { - return new(fastReflection_Ticker) +func (x *fastReflection_Market) New() protoreflect.Message { + return new(fastReflection_Market) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_Ticker) Interface() protoreflect.ProtoMessage { - return (*Ticker)(x) +func (x *fastReflection_Market) Interface() protoreflect.ProtoMessage { + return (*Market)(x) } // Range iterates over every populated field in an undefined order, @@ -98,34 +143,16 @@ func (x *fastReflection_Ticker) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_Ticker) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.CurrencyPair != nil { - value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - if !f(fd_Ticker_currency_pair, value) { - return - } - } - if x.Decimals != uint64(0) { - value := protoreflect.ValueOfUint64(x.Decimals) - if !f(fd_Ticker_decimals, value) { - return - } - } - if x.MinProviderCount != uint64(0) { - value := protoreflect.ValueOfUint64(x.MinProviderCount) - if !f(fd_Ticker_min_provider_count, value) { - return - } - } - if x.Enabled != false { - value := protoreflect.ValueOfBool(x.Enabled) - if !f(fd_Ticker_enabled, value) { +func (x *fastReflection_Market) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Ticker != nil { + value := protoreflect.ValueOfMessage(x.Ticker.ProtoReflect()) + if !f(fd_Market_ticker, value) { return } } - if x.Metadata_JSON != "" { - value := protoreflect.ValueOfString(x.Metadata_JSON) - if !f(fd_Ticker_metadata_JSON, value) { + if len(x.ProviderConfigs) != 0 { + value := protoreflect.ValueOfList(&_Market_2_list{list: &x.ProviderConfigs}) + if !f(fd_Market_provider_configs, value) { return } } @@ -142,23 +169,17 @@ func (x *fastReflection_Ticker) Range(f func(protoreflect.FieldDescriptor, proto // 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_Ticker) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_Market) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.Ticker.currency_pair": - return x.CurrencyPair != nil - case "slinky.marketmap.v1.Ticker.decimals": - return x.Decimals != uint64(0) - case "slinky.marketmap.v1.Ticker.min_provider_count": - return x.MinProviderCount != uint64(0) - case "slinky.marketmap.v1.Ticker.enabled": - return x.Enabled != false - case "slinky.marketmap.v1.Ticker.metadata_JSON": - return x.Metadata_JSON != "" + case "slinky.marketmap.v1.Market.ticker": + return x.Ticker != nil + case "slinky.marketmap.v1.Market.provider_configs": + return len(x.ProviderConfigs) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Market")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Market does not contain field %s", fd.FullName())) } } @@ -168,23 +189,17 @@ func (x *fastReflection_Ticker) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Ticker) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_Market) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.Ticker.currency_pair": - x.CurrencyPair = nil - case "slinky.marketmap.v1.Ticker.decimals": - x.Decimals = uint64(0) - case "slinky.marketmap.v1.Ticker.min_provider_count": - x.MinProviderCount = uint64(0) - case "slinky.marketmap.v1.Ticker.enabled": - x.Enabled = false - case "slinky.marketmap.v1.Ticker.metadata_JSON": - x.Metadata_JSON = "" + case "slinky.marketmap.v1.Market.ticker": + x.Ticker = nil + case "slinky.marketmap.v1.Market.provider_configs": + x.ProviderConfigs = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Market")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Market does not contain field %s", fd.FullName())) } } @@ -194,28 +209,22 @@ func (x *fastReflection_Ticker) Clear(fd protoreflect.FieldDescriptor) { // 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_Ticker) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Market) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.Ticker.currency_pair": - value := x.CurrencyPair + case "slinky.marketmap.v1.Market.ticker": + value := x.Ticker return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.marketmap.v1.Ticker.decimals": - value := x.Decimals - return protoreflect.ValueOfUint64(value) - case "slinky.marketmap.v1.Ticker.min_provider_count": - value := x.MinProviderCount - return protoreflect.ValueOfUint64(value) - case "slinky.marketmap.v1.Ticker.enabled": - value := x.Enabled - return protoreflect.ValueOfBool(value) - case "slinky.marketmap.v1.Ticker.metadata_JSON": - value := x.Metadata_JSON - return protoreflect.ValueOfString(value) + case "slinky.marketmap.v1.Market.provider_configs": + if len(x.ProviderConfigs) == 0 { + return protoreflect.ValueOfList(&_Market_2_list{}) + } + listValue := &_Market_2_list{list: &x.ProviderConfigs} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Market")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Market does not contain field %s", descriptor.FullName())) } } @@ -229,23 +238,19 @@ func (x *fastReflection_Ticker) Get(descriptor protoreflect.FieldDescriptor) pro // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Ticker) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_Market) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.Ticker.currency_pair": - x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) - case "slinky.marketmap.v1.Ticker.decimals": - x.Decimals = value.Uint() - case "slinky.marketmap.v1.Ticker.min_provider_count": - x.MinProviderCount = value.Uint() - case "slinky.marketmap.v1.Ticker.enabled": - x.Enabled = value.Bool() - case "slinky.marketmap.v1.Ticker.metadata_JSON": - x.Metadata_JSON = value.Interface().(string) + case "slinky.marketmap.v1.Market.ticker": + x.Ticker = value.Message().Interface().(*Ticker) + case "slinky.marketmap.v1.Market.provider_configs": + lv := value.List() + clv := lv.(*_Market_2_list) + x.ProviderConfigs = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Market")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Market does not contain field %s", fd.FullName())) } } @@ -259,60 +264,53 @@ func (x *fastReflection_Ticker) Set(fd protoreflect.FieldDescriptor, value proto // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Ticker) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Market) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Ticker.currency_pair": - if x.CurrencyPair == nil { - x.CurrencyPair = new(v1.CurrencyPair) + case "slinky.marketmap.v1.Market.ticker": + if x.Ticker == nil { + x.Ticker = new(Ticker) } - return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - case "slinky.marketmap.v1.Ticker.decimals": - panic(fmt.Errorf("field decimals of message slinky.marketmap.v1.Ticker is not mutable")) - case "slinky.marketmap.v1.Ticker.min_provider_count": - panic(fmt.Errorf("field min_provider_count of message slinky.marketmap.v1.Ticker is not mutable")) - case "slinky.marketmap.v1.Ticker.enabled": - panic(fmt.Errorf("field enabled of message slinky.marketmap.v1.Ticker is not mutable")) - case "slinky.marketmap.v1.Ticker.metadata_JSON": - panic(fmt.Errorf("field metadata_JSON of message slinky.marketmap.v1.Ticker is not mutable")) + return protoreflect.ValueOfMessage(x.Ticker.ProtoReflect()) + case "slinky.marketmap.v1.Market.provider_configs": + if x.ProviderConfigs == nil { + x.ProviderConfigs = []*ProviderConfig{} + } + value := &_Market_2_list{list: &x.ProviderConfigs} + return protoreflect.ValueOfList(value) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Market")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Market 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_Ticker) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Market) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Ticker.currency_pair": - m := new(v1.CurrencyPair) + case "slinky.marketmap.v1.Market.ticker": + m := new(Ticker) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.marketmap.v1.Ticker.decimals": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.marketmap.v1.Ticker.min_provider_count": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.marketmap.v1.Ticker.enabled": - return protoreflect.ValueOfBool(false) - case "slinky.marketmap.v1.Ticker.metadata_JSON": - return protoreflect.ValueOfString("") + case "slinky.marketmap.v1.Market.provider_configs": + list := []*ProviderConfig{} + return protoreflect.ValueOfList(&_Market_2_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Market")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Market 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_Ticker) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_Market) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Ticker", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Market", d.FullName())) } panic("unreachable") } @@ -320,7 +318,7 @@ func (x *fastReflection_Ticker) WhichOneof(d protoreflect.OneofDescriptor) proto // 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_Ticker) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_Market) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -331,7 +329,7 @@ func (x *fastReflection_Ticker) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Ticker) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_Market) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -343,7 +341,7 @@ func (x *fastReflection_Ticker) SetUnknown(fields protoreflect.RawFields) { // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_Ticker) IsValid() bool { +func (x *fastReflection_Market) IsValid() bool { return x != nil } @@ -353,9 +351,9 @@ func (x *fastReflection_Ticker) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_Market) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Ticker) + x := input.Message.Interface().(*Market) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -367,22 +365,15 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.CurrencyPair != nil { - l = options.Size(x.CurrencyPair) + if x.Ticker != nil { + l = options.Size(x.Ticker) n += 1 + l + runtime.Sov(uint64(l)) } - if x.Decimals != 0 { - n += 1 + runtime.Sov(uint64(x.Decimals)) - } - if x.MinProviderCount != 0 { - n += 1 + runtime.Sov(uint64(x.MinProviderCount)) - } - if x.Enabled { - n += 2 - } - l = len(x.Metadata_JSON) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.ProviderConfigs) > 0 { + for _, e := range x.ProviderConfigs { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -394,7 +385,7 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Ticker) + x := input.Message.Interface().(*Market) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -413,35 +404,24 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Metadata_JSON) > 0 { - i -= len(x.Metadata_JSON) - copy(dAtA[i:], x.Metadata_JSON) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata_JSON))) - i-- - dAtA[i] = 0x7a - } - if x.Enabled { - i-- - if x.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 + if len(x.ProviderConfigs) > 0 { + for iNdEx := len(x.ProviderConfigs) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.ProviderConfigs[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 } - i-- - dAtA[i] = 0x70 - } - if x.MinProviderCount != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.MinProviderCount)) - i-- - dAtA[i] = 0x18 - } - if x.Decimals != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Decimals)) - i-- - dAtA[i] = 0x10 } - if x.CurrencyPair != nil { - encoded, err := options.Marshal(x.CurrencyPair) + if x.Ticker != nil { + encoded, err := options.Marshal(x.Ticker) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -465,7 +445,7 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Ticker) + x := input.Message.Interface().(*Market) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -497,15 +477,15 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Ticker: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Market: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Ticker: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Market: 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 CurrencyPair", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -532,76 +512,18 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.CurrencyPair == nil { - x.CurrencyPair = &v1.CurrencyPair{} + if x.Ticker == nil { + x.Ticker = &Ticker{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Ticker); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) - } - x.Decimals = 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.Decimals |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinProviderCount", wireType) - } - x.MinProviderCount = 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.MinProviderCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Enabled = bool(v != 0) - case 15: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProviderConfigs", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -611,23 +533,25 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Metadata_JSON = string(dAtA[iNdEx:postIndex]) + x.ProviderConfigs = append(x.ProviderConfigs, &ProviderConfig{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ProviderConfigs[len(x.ProviderConfigs)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex default: iNdEx = preIndex @@ -665,27 +589,33 @@ func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { } var ( - md_ProviderConfig protoreflect.MessageDescriptor - fd_ProviderConfig_name protoreflect.FieldDescriptor - fd_ProviderConfig_off_chain_ticker protoreflect.FieldDescriptor + md_Ticker protoreflect.MessageDescriptor + fd_Ticker_currency_pair protoreflect.FieldDescriptor + fd_Ticker_decimals protoreflect.FieldDescriptor + fd_Ticker_min_provider_count protoreflect.FieldDescriptor + fd_Ticker_enabled protoreflect.FieldDescriptor + fd_Ticker_metadata_JSON protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_market_proto_init() - md_ProviderConfig = File_slinky_marketmap_v1_market_proto.Messages().ByName("ProviderConfig") - fd_ProviderConfig_name = md_ProviderConfig.Fields().ByName("name") - fd_ProviderConfig_off_chain_ticker = md_ProviderConfig.Fields().ByName("off_chain_ticker") + md_Ticker = File_slinky_marketmap_v1_market_proto.Messages().ByName("Ticker") + fd_Ticker_currency_pair = md_Ticker.Fields().ByName("currency_pair") + fd_Ticker_decimals = md_Ticker.Fields().ByName("decimals") + fd_Ticker_min_provider_count = md_Ticker.Fields().ByName("min_provider_count") + fd_Ticker_enabled = md_Ticker.Fields().ByName("enabled") + fd_Ticker_metadata_JSON = md_Ticker.Fields().ByName("metadata_JSON") } -var _ protoreflect.Message = (*fastReflection_ProviderConfig)(nil) +var _ protoreflect.Message = (*fastReflection_Ticker)(nil) -type fastReflection_ProviderConfig ProviderConfig +type fastReflection_Ticker Ticker -func (x *ProviderConfig) ProtoReflect() protoreflect.Message { - return (*fastReflection_ProviderConfig)(x) +func (x *Ticker) ProtoReflect() protoreflect.Message { + return (*fastReflection_Ticker)(x) } -func (x *ProviderConfig) slowProtoReflect() protoreflect.Message { +func (x *Ticker) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_market_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -697,43 +627,43 @@ func (x *ProviderConfig) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_ProviderConfig_messageType fastReflection_ProviderConfig_messageType -var _ protoreflect.MessageType = fastReflection_ProviderConfig_messageType{} +var _fastReflection_Ticker_messageType fastReflection_Ticker_messageType +var _ protoreflect.MessageType = fastReflection_Ticker_messageType{} -type fastReflection_ProviderConfig_messageType struct{} +type fastReflection_Ticker_messageType struct{} -func (x fastReflection_ProviderConfig_messageType) Zero() protoreflect.Message { - return (*fastReflection_ProviderConfig)(nil) +func (x fastReflection_Ticker_messageType) Zero() protoreflect.Message { + return (*fastReflection_Ticker)(nil) } -func (x fastReflection_ProviderConfig_messageType) New() protoreflect.Message { - return new(fastReflection_ProviderConfig) +func (x fastReflection_Ticker_messageType) New() protoreflect.Message { + return new(fastReflection_Ticker) } -func (x fastReflection_ProviderConfig_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ProviderConfig +func (x fastReflection_Ticker_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_Ticker } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_ProviderConfig) Descriptor() protoreflect.MessageDescriptor { - return md_ProviderConfig +func (x *fastReflection_Ticker) Descriptor() protoreflect.MessageDescriptor { + return md_Ticker } // 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_ProviderConfig) Type() protoreflect.MessageType { - return _fastReflection_ProviderConfig_messageType +func (x *fastReflection_Ticker) Type() protoreflect.MessageType { + return _fastReflection_Ticker_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_ProviderConfig) New() protoreflect.Message { - return new(fastReflection_ProviderConfig) +func (x *fastReflection_Ticker) New() protoreflect.Message { + return new(fastReflection_Ticker) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_ProviderConfig) Interface() protoreflect.ProtoMessage { - return (*ProviderConfig)(x) +func (x *fastReflection_Ticker) Interface() protoreflect.ProtoMessage { + return (*Ticker)(x) } // Range iterates over every populated field in an undefined order, @@ -741,16 +671,34 @@ func (x *fastReflection_ProviderConfig) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_ProviderConfig) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Name != "" { - value := protoreflect.ValueOfString(x.Name) - if !f(fd_ProviderConfig_name, value) { +func (x *fastReflection_Ticker) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.CurrencyPair != nil { + value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) + if !f(fd_Ticker_currency_pair, value) { return } } - if x.OffChainTicker != "" { - value := protoreflect.ValueOfString(x.OffChainTicker) - if !f(fd_ProviderConfig_off_chain_ticker, value) { + if x.Decimals != uint64(0) { + value := protoreflect.ValueOfUint64(x.Decimals) + if !f(fd_Ticker_decimals, value) { + return + } + } + if x.MinProviderCount != uint64(0) { + value := protoreflect.ValueOfUint64(x.MinProviderCount) + if !f(fd_Ticker_min_provider_count, value) { + return + } + } + if x.Enabled != false { + value := protoreflect.ValueOfBool(x.Enabled) + if !f(fd_Ticker_enabled, value) { + return + } + } + if x.Metadata_JSON != "" { + value := protoreflect.ValueOfString(x.Metadata_JSON) + if !f(fd_Ticker_metadata_JSON, value) { return } } @@ -767,17 +715,23 @@ func (x *fastReflection_ProviderConfig) Range(f func(protoreflect.FieldDescripto // 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_ProviderConfig) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_Ticker) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.ProviderConfig.name": - return x.Name != "" - case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": - return x.OffChainTicker != "" + case "slinky.marketmap.v1.Ticker.currency_pair": + return x.CurrencyPair != nil + case "slinky.marketmap.v1.Ticker.decimals": + return x.Decimals != uint64(0) + case "slinky.marketmap.v1.Ticker.min_provider_count": + return x.MinProviderCount != uint64(0) + case "slinky.marketmap.v1.Ticker.enabled": + return x.Enabled != false + case "slinky.marketmap.v1.Ticker.metadata_JSON": + return x.Metadata_JSON != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) } - panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) } } @@ -787,17 +741,23 @@ func (x *fastReflection_ProviderConfig) Has(fd protoreflect.FieldDescriptor) boo // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ProviderConfig) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_Ticker) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.ProviderConfig.name": - x.Name = "" - case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": - x.OffChainTicker = "" + case "slinky.marketmap.v1.Ticker.currency_pair": + x.CurrencyPair = nil + case "slinky.marketmap.v1.Ticker.decimals": + x.Decimals = uint64(0) + case "slinky.marketmap.v1.Ticker.min_provider_count": + x.MinProviderCount = uint64(0) + case "slinky.marketmap.v1.Ticker.enabled": + x.Enabled = false + case "slinky.marketmap.v1.Ticker.metadata_JSON": + x.Metadata_JSON = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) } - panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) } } @@ -807,19 +767,28 @@ func (x *fastReflection_ProviderConfig) Clear(fd protoreflect.FieldDescriptor) { // 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_ProviderConfig) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Ticker) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.ProviderConfig.name": - value := x.Name - return protoreflect.ValueOfString(value) - case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": - value := x.OffChainTicker + case "slinky.marketmap.v1.Ticker.currency_pair": + value := x.CurrencyPair + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "slinky.marketmap.v1.Ticker.decimals": + value := x.Decimals + return protoreflect.ValueOfUint64(value) + case "slinky.marketmap.v1.Ticker.min_provider_count": + value := x.MinProviderCount + return protoreflect.ValueOfUint64(value) + case "slinky.marketmap.v1.Ticker.enabled": + value := x.Enabled + return protoreflect.ValueOfBool(value) + case "slinky.marketmap.v1.Ticker.metadata_JSON": + value := x.Metadata_JSON return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) } - panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", descriptor.FullName())) } } @@ -833,17 +802,23 @@ func (x *fastReflection_ProviderConfig) Get(descriptor protoreflect.FieldDescrip // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ProviderConfig) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_Ticker) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.ProviderConfig.name": - x.Name = value.Interface().(string) - case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": - x.OffChainTicker = value.Interface().(string) + case "slinky.marketmap.v1.Ticker.currency_pair": + x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) + case "slinky.marketmap.v1.Ticker.decimals": + x.Decimals = value.Uint() + case "slinky.marketmap.v1.Ticker.min_provider_count": + x.MinProviderCount = value.Uint() + case "slinky.marketmap.v1.Ticker.enabled": + x.Enabled = value.Bool() + case "slinky.marketmap.v1.Ticker.metadata_JSON": + x.Metadata_JSON = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) } - panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Ticker does not contain field %s", fd.FullName())) } } @@ -857,44 +832,60 @@ func (x *fastReflection_ProviderConfig) Set(fd protoreflect.FieldDescriptor, val // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ProviderConfig) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Ticker) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.ProviderConfig.name": - panic(fmt.Errorf("field name of message slinky.marketmap.v1.ProviderConfig is not mutable")) - case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": - panic(fmt.Errorf("field off_chain_ticker of message slinky.marketmap.v1.ProviderConfig is not mutable")) + case "slinky.marketmap.v1.Ticker.currency_pair": + if x.CurrencyPair == nil { + x.CurrencyPair = new(v1.CurrencyPair) + } + return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) + case "slinky.marketmap.v1.Ticker.decimals": + panic(fmt.Errorf("field decimals of message slinky.marketmap.v1.Ticker is not mutable")) + case "slinky.marketmap.v1.Ticker.min_provider_count": + panic(fmt.Errorf("field min_provider_count of message slinky.marketmap.v1.Ticker is not mutable")) + case "slinky.marketmap.v1.Ticker.enabled": + panic(fmt.Errorf("field enabled of message slinky.marketmap.v1.Ticker is not mutable")) + case "slinky.marketmap.v1.Ticker.metadata_JSON": + panic(fmt.Errorf("field metadata_JSON of message slinky.marketmap.v1.Ticker is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) } - panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Ticker 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_ProviderConfig) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_Ticker) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.ProviderConfig.name": - return protoreflect.ValueOfString("") - case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + case "slinky.marketmap.v1.Ticker.currency_pair": + m := new(v1.CurrencyPair) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "slinky.marketmap.v1.Ticker.decimals": + return protoreflect.ValueOfUint64(uint64(0)) + case "slinky.marketmap.v1.Ticker.min_provider_count": + return protoreflect.ValueOfUint64(uint64(0)) + case "slinky.marketmap.v1.Ticker.enabled": + return protoreflect.ValueOfBool(false) + case "slinky.marketmap.v1.Ticker.metadata_JSON": return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Ticker")) } - panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.Ticker 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_ProviderConfig) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_Ticker) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.ProviderConfig", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Ticker", d.FullName())) } panic("unreachable") } @@ -902,7 +893,7 @@ func (x *fastReflection_ProviderConfig) WhichOneof(d protoreflect.OneofDescripto // 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_ProviderConfig) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_Ticker) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -913,7 +904,7 @@ func (x *fastReflection_ProviderConfig) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_ProviderConfig) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_Ticker) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -925,7 +916,7 @@ func (x *fastReflection_ProviderConfig) SetUnknown(fields protoreflect.RawFields // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_ProviderConfig) IsValid() bool { +func (x *fastReflection_Ticker) IsValid() bool { return x != nil } @@ -935,9 +926,9 @@ func (x *fastReflection_ProviderConfig) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_Ticker) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ProviderConfig) + x := input.Message.Interface().(*Ticker) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -949,11 +940,20 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Name) - if l > 0 { + if x.CurrencyPair != nil { + l = options.Size(x.CurrencyPair) n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.OffChainTicker) + if x.Decimals != 0 { + n += 1 + runtime.Sov(uint64(x.Decimals)) + } + if x.MinProviderCount != 0 { + n += 1 + runtime.Sov(uint64(x.MinProviderCount)) + } + if x.Enabled { + n += 2 + } + l = len(x.Metadata_JSON) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -967,7 +967,7 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*ProviderConfig) + x := input.Message.Interface().(*Ticker) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -986,17 +986,44 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.OffChainTicker) > 0 { - i -= len(x.OffChainTicker) - copy(dAtA[i:], x.OffChainTicker) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.OffChainTicker))) + if len(x.Metadata_JSON) > 0 { + i -= len(x.Metadata_JSON) + copy(dAtA[i:], x.Metadata_JSON) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata_JSON))) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x7a } - if len(x.Name) > 0 { - i -= len(x.Name) - copy(dAtA[i:], x.Name) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + if x.Enabled { + i-- + if x.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x70 + } + if x.MinProviderCount != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.MinProviderCount)) + i-- + dAtA[i] = 0x18 + } + if x.Decimals != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.Decimals)) + i-- + dAtA[i] = 0x10 + } + if x.CurrencyPair != nil { + encoded, err := options.Marshal(x.CurrencyPair) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -1011,7 +1038,7 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ProviderConfig) + x := input.Message.Interface().(*Ticker) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1043,17 +1070,17 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ProviderConfig: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Ticker: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ProviderConfig: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Ticker: 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 Name", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1063,27 +1090,89 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Name = string(dAtA[iNdEx:postIndex]) + if x.CurrencyPair == nil { + x.CurrencyPair = &v1.CurrencyPair{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + x.Decimals = 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.Decimals |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinProviderCount", wireType) + } + x.MinProviderCount = 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.MinProviderCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Enabled = bool(v != 0) + case 15: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field OffChainTicker", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1111,7 +1200,7 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.OffChainTicker = string(dAtA[iNdEx:postIndex]) + x.Metadata_JSON = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1148,77 +1237,34 @@ func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_Path_1_list)(nil) - -type _Path_1_list struct { - list *[]*Operation -} - -func (x *_Path_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Path_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_Path_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Operation) - (*x.list)[i] = concreteValue -} - -func (x *_Path_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Operation) - *x.list = append(*x.list, concreteValue) -} - -func (x *_Path_1_list) AppendMutable() protoreflect.Value { - v := new(Operation) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Path_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_Path_1_list) NewElement() protoreflect.Value { - v := new(Operation) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Path_1_list) IsValid() bool { - return x.list != nil -} - var ( - md_Path protoreflect.MessageDescriptor - fd_Path_operations protoreflect.FieldDescriptor + md_ProviderConfig protoreflect.MessageDescriptor + fd_ProviderConfig_name protoreflect.FieldDescriptor + fd_ProviderConfig_off_chain_ticker protoreflect.FieldDescriptor + fd_ProviderConfig_normalize_by_pair protoreflect.FieldDescriptor + fd_ProviderConfig_invert protoreflect.FieldDescriptor + fd_ProviderConfig_metadata_JSON protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_market_proto_init() - md_Path = File_slinky_marketmap_v1_market_proto.Messages().ByName("Path") - fd_Path_operations = md_Path.Fields().ByName("operations") + md_ProviderConfig = File_slinky_marketmap_v1_market_proto.Messages().ByName("ProviderConfig") + fd_ProviderConfig_name = md_ProviderConfig.Fields().ByName("name") + fd_ProviderConfig_off_chain_ticker = md_ProviderConfig.Fields().ByName("off_chain_ticker") + fd_ProviderConfig_normalize_by_pair = md_ProviderConfig.Fields().ByName("normalize_by_pair") + fd_ProviderConfig_invert = md_ProviderConfig.Fields().ByName("invert") + fd_ProviderConfig_metadata_JSON = md_ProviderConfig.Fields().ByName("metadata_JSON") } -var _ protoreflect.Message = (*fastReflection_Path)(nil) +var _ protoreflect.Message = (*fastReflection_ProviderConfig)(nil) -type fastReflection_Path Path +type fastReflection_ProviderConfig ProviderConfig -func (x *Path) ProtoReflect() protoreflect.Message { - return (*fastReflection_Path)(x) +func (x *ProviderConfig) ProtoReflect() protoreflect.Message { + return (*fastReflection_ProviderConfig)(x) } -func (x *Path) slowProtoReflect() protoreflect.Message { +func (x *ProviderConfig) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_market_proto_msgTypes[2] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1230,43 +1276,43 @@ func (x *Path) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_Path_messageType fastReflection_Path_messageType -var _ protoreflect.MessageType = fastReflection_Path_messageType{} +var _fastReflection_ProviderConfig_messageType fastReflection_ProviderConfig_messageType +var _ protoreflect.MessageType = fastReflection_ProviderConfig_messageType{} -type fastReflection_Path_messageType struct{} +type fastReflection_ProviderConfig_messageType struct{} -func (x fastReflection_Path_messageType) Zero() protoreflect.Message { - return (*fastReflection_Path)(nil) +func (x fastReflection_ProviderConfig_messageType) Zero() protoreflect.Message { + return (*fastReflection_ProviderConfig)(nil) } -func (x fastReflection_Path_messageType) New() protoreflect.Message { - return new(fastReflection_Path) +func (x fastReflection_ProviderConfig_messageType) New() protoreflect.Message { + return new(fastReflection_ProviderConfig) } -func (x fastReflection_Path_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Path +func (x fastReflection_ProviderConfig_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_ProviderConfig } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_Path) Descriptor() protoreflect.MessageDescriptor { - return md_Path +func (x *fastReflection_ProviderConfig) Descriptor() protoreflect.MessageDescriptor { + return md_ProviderConfig } // 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_Path) Type() protoreflect.MessageType { - return _fastReflection_Path_messageType +func (x *fastReflection_ProviderConfig) Type() protoreflect.MessageType { + return _fastReflection_ProviderConfig_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_Path) New() protoreflect.Message { - return new(fastReflection_Path) +func (x *fastReflection_ProviderConfig) New() protoreflect.Message { + return new(fastReflection_ProviderConfig) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_Path) Interface() protoreflect.ProtoMessage { - return (*Path)(x) +func (x *fastReflection_ProviderConfig) Interface() protoreflect.ProtoMessage { + return (*ProviderConfig)(x) } // Range iterates over every populated field in an undefined order, @@ -1274,10 +1320,34 @@ func (x *fastReflection_Path) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_Path) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Operations) != 0 { - value := protoreflect.ValueOfList(&_Path_1_list{list: &x.Operations}) - if !f(fd_Path_operations, value) { +func (x *fastReflection_ProviderConfig) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Name != "" { + value := protoreflect.ValueOfString(x.Name) + if !f(fd_ProviderConfig_name, value) { + return + } + } + if x.OffChainTicker != "" { + value := protoreflect.ValueOfString(x.OffChainTicker) + if !f(fd_ProviderConfig_off_chain_ticker, value) { + return + } + } + if x.NormalizeByPair != nil { + value := protoreflect.ValueOfMessage(x.NormalizeByPair.ProtoReflect()) + if !f(fd_ProviderConfig_normalize_by_pair, value) { + return + } + } + if x.Invert != false { + value := protoreflect.ValueOfBool(x.Invert) + if !f(fd_ProviderConfig_invert, value) { + return + } + } + if x.Metadata_JSON != "" { + value := protoreflect.ValueOfString(x.Metadata_JSON) + if !f(fd_ProviderConfig_metadata_JSON, value) { return } } @@ -1294,15 +1364,23 @@ func (x *fastReflection_Path) Range(f func(protoreflect.FieldDescriptor, protore // 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_Path) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_ProviderConfig) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.Path.operations": - return len(x.Operations) != 0 + case "slinky.marketmap.v1.ProviderConfig.name": + return x.Name != "" + case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + return x.OffChainTicker != "" + case "slinky.marketmap.v1.ProviderConfig.normalize_by_pair": + return x.NormalizeByPair != nil + case "slinky.marketmap.v1.ProviderConfig.invert": + return x.Invert != false + case "slinky.marketmap.v1.ProviderConfig.metadata_JSON": + return x.Metadata_JSON != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Path")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Path does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) } } @@ -1312,15 +1390,23 @@ func (x *fastReflection_Path) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Path) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_ProviderConfig) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.Path.operations": - x.Operations = nil + case "slinky.marketmap.v1.ProviderConfig.name": + x.Name = "" + case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + x.OffChainTicker = "" + case "slinky.marketmap.v1.ProviderConfig.normalize_by_pair": + x.NormalizeByPair = nil + case "slinky.marketmap.v1.ProviderConfig.invert": + x.Invert = false + case "slinky.marketmap.v1.ProviderConfig.metadata_JSON": + x.Metadata_JSON = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Path")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Path does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) } } @@ -1330,19 +1416,28 @@ func (x *fastReflection_Path) Clear(fd protoreflect.FieldDescriptor) { // 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_Path) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_ProviderConfig) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.Path.operations": - if len(x.Operations) == 0 { - return protoreflect.ValueOfList(&_Path_1_list{}) - } - listValue := &_Path_1_list{list: &x.Operations} - return protoreflect.ValueOfList(listValue) + case "slinky.marketmap.v1.ProviderConfig.name": + value := x.Name + return protoreflect.ValueOfString(value) + case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + value := x.OffChainTicker + return protoreflect.ValueOfString(value) + case "slinky.marketmap.v1.ProviderConfig.normalize_by_pair": + value := x.NormalizeByPair + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "slinky.marketmap.v1.ProviderConfig.invert": + value := x.Invert + return protoreflect.ValueOfBool(value) + case "slinky.marketmap.v1.ProviderConfig.metadata_JSON": + value := x.Metadata_JSON + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Path")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Path does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", descriptor.FullName())) } } @@ -1356,17 +1451,23 @@ func (x *fastReflection_Path) Get(descriptor protoreflect.FieldDescriptor) proto // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Path) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_ProviderConfig) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.Path.operations": - lv := value.List() - clv := lv.(*_Path_1_list) - x.Operations = *clv.list + case "slinky.marketmap.v1.ProviderConfig.name": + x.Name = value.Interface().(string) + case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + x.OffChainTicker = value.Interface().(string) + case "slinky.marketmap.v1.ProviderConfig.normalize_by_pair": + x.NormalizeByPair = value.Message().Interface().(*v1.CurrencyPair) + case "slinky.marketmap.v1.ProviderConfig.invert": + x.Invert = value.Bool() + case "slinky.marketmap.v1.ProviderConfig.metadata_JSON": + x.Metadata_JSON = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Path")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Path does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig does not contain field %s", fd.FullName())) } } @@ -1380,45 +1481,60 @@ func (x *fastReflection_Path) Set(fd protoreflect.FieldDescriptor, value protore // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Path) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_ProviderConfig) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Path.operations": - if x.Operations == nil { - x.Operations = []*Operation{} + case "slinky.marketmap.v1.ProviderConfig.normalize_by_pair": + if x.NormalizeByPair == nil { + x.NormalizeByPair = new(v1.CurrencyPair) } - value := &_Path_1_list{list: &x.Operations} - return protoreflect.ValueOfList(value) + return protoreflect.ValueOfMessage(x.NormalizeByPair.ProtoReflect()) + case "slinky.marketmap.v1.ProviderConfig.name": + panic(fmt.Errorf("field name of message slinky.marketmap.v1.ProviderConfig is not mutable")) + case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + panic(fmt.Errorf("field off_chain_ticker of message slinky.marketmap.v1.ProviderConfig is not mutable")) + case "slinky.marketmap.v1.ProviderConfig.invert": + panic(fmt.Errorf("field invert of message slinky.marketmap.v1.ProviderConfig is not mutable")) + case "slinky.marketmap.v1.ProviderConfig.metadata_JSON": + panic(fmt.Errorf("field metadata_JSON of message slinky.marketmap.v1.ProviderConfig is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Path")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Path does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig 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_Path) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_ProviderConfig) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Path.operations": - list := []*Operation{} - return protoreflect.ValueOfList(&_Path_1_list{list: &list}) + case "slinky.marketmap.v1.ProviderConfig.name": + return protoreflect.ValueOfString("") + case "slinky.marketmap.v1.ProviderConfig.off_chain_ticker": + return protoreflect.ValueOfString("") + case "slinky.marketmap.v1.ProviderConfig.normalize_by_pair": + m := new(v1.CurrencyPair) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "slinky.marketmap.v1.ProviderConfig.invert": + return protoreflect.ValueOfBool(false) + case "slinky.marketmap.v1.ProviderConfig.metadata_JSON": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Path")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.ProviderConfig")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Path does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.ProviderConfig 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_Path) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_ProviderConfig) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Path", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.ProviderConfig", d.FullName())) } panic("unreachable") } @@ -1426,7 +1542,7 @@ func (x *fastReflection_Path) WhichOneof(d protoreflect.OneofDescriptor) protore // 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_Path) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_ProviderConfig) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1437,7 +1553,7 @@ func (x *fastReflection_Path) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Path) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_ProviderConfig) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1449,7 +1565,7 @@ func (x *fastReflection_Path) SetUnknown(fields protoreflect.RawFields) { // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_Path) IsValid() bool { +func (x *fastReflection_ProviderConfig) IsValid() bool { return x != nil } @@ -1459,9 +1575,9 @@ func (x *fastReflection_Path) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_ProviderConfig) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Path) + x := input.Message.Interface().(*ProviderConfig) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1473,11 +1589,24 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if len(x.Operations) > 0 { - for _, e := range x.Operations { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Name) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.OffChainTicker) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.NormalizeByPair != nil { + l = options.Size(x.NormalizeByPair) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.Invert { + n += 2 + } + l = len(x.Metadata_JSON) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1489,7 +1618,7 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Path) + x := input.Message.Interface().(*ProviderConfig) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1508,21 +1637,50 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Operations) > 0 { - for iNdEx := len(x.Operations) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Operations[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa + if len(x.Metadata_JSON) > 0 { + i -= len(x.Metadata_JSON) + copy(dAtA[i:], x.Metadata_JSON) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata_JSON))) + i-- + dAtA[i] = 0x7a + } + if x.Invert { + i-- + if x.Invert { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if x.NormalizeByPair != nil { + encoded, err := options.Marshal(x.NormalizeByPair) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if len(x.OffChainTicker) > 0 { + i -= len(x.OffChainTicker) + copy(dAtA[i:], x.OffChainTicker) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.OffChainTicker))) + i-- + dAtA[i] = 0x12 + } + if len(x.Name) > 0 { + i -= len(x.Name) + copy(dAtA[i:], x.Name) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) + i-- + dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1535,7 +1693,7 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Path) + x := input.Message.Interface().(*ProviderConfig) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1567,17 +1725,17 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Path: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ProviderConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Path: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ProviderConfig: 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 Operations", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1587,50 +1745,168 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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.Operations = append(x.Operations, &Operation{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Operations[len(x.Operations)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + x.Name = 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 OffChainTicker", 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.OffChainTicker = 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 + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field NormalizeByPair", wireType) } - if (skippy < 0) || (iNdEx+skippy) < 0 { + 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 } - if (iNdEx + skippy) > l { + 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 !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + if x.NormalizeByPair == nil { + x.NormalizeByPair = &v1.CurrencyPair{} } - 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 - } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.NormalizeByPair); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Invert", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + x.Invert = bool(v != 0) + case 15: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", 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.Metadata_JSON = 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, @@ -1642,30 +1918,116 @@ func (x *fastReflection_Path) ProtoMethods() *protoiface.Methods { } } +var _ protoreflect.Map = (*_MarketMap_1_map)(nil) + +type _MarketMap_1_map struct { + m *map[string]*Market +} + +func (x *_MarketMap_1_map) Len() int { + if x.m == nil { + return 0 + } + return len(*x.m) +} + +func (x *_MarketMap_1_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { + if x.m == nil { + return + } + for k, v := range *x.m { + mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) + mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) + if !f(mapKey, mapValue) { + break + } + } +} + +func (x *_MarketMap_1_map) Has(key protoreflect.MapKey) bool { + if x.m == nil { + return false + } + keyUnwrapped := key.String() + concreteValue := keyUnwrapped + _, ok := (*x.m)[concreteValue] + return ok +} + +func (x *_MarketMap_1_map) Clear(key protoreflect.MapKey) { + if x.m == nil { + return + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + delete(*x.m, concreteKey) +} + +func (x *_MarketMap_1_map) Get(key protoreflect.MapKey) protoreflect.Value { + if x.m == nil { + return protoreflect.Value{} + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if !ok { + return protoreflect.Value{} + } + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MarketMap_1_map) Set(key protoreflect.MapKey, value protoreflect.Value) { + if !key.IsValid() || !value.IsValid() { + panic("invalid key or value provided") + } + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Market) + (*x.m)[concreteKey] = concreteValue +} + +func (x *_MarketMap_1_map) Mutable(key protoreflect.MapKey) protoreflect.Value { + keyUnwrapped := key.String() + concreteKey := keyUnwrapped + v, ok := (*x.m)[concreteKey] + if ok { + return protoreflect.ValueOfMessage(v.ProtoReflect()) + } + newValue := new(Market) + (*x.m)[concreteKey] = newValue + return protoreflect.ValueOfMessage(newValue.ProtoReflect()) +} + +func (x *_MarketMap_1_map) NewValue() protoreflect.Value { + v := new(Market) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MarketMap_1_map) IsValid() bool { + return x.m != nil +} + var ( - md_Operation protoreflect.MessageDescriptor - fd_Operation_currency_pair protoreflect.FieldDescriptor - fd_Operation_invert protoreflect.FieldDescriptor - fd_Operation_provider protoreflect.FieldDescriptor + md_MarketMap protoreflect.MessageDescriptor + fd_MarketMap_markets protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_market_proto_init() - md_Operation = File_slinky_marketmap_v1_market_proto.Messages().ByName("Operation") - fd_Operation_currency_pair = md_Operation.Fields().ByName("currency_pair") - fd_Operation_invert = md_Operation.Fields().ByName("invert") - fd_Operation_provider = md_Operation.Fields().ByName("provider") + md_MarketMap = File_slinky_marketmap_v1_market_proto.Messages().ByName("MarketMap") + fd_MarketMap_markets = md_MarketMap.Fields().ByName("markets") } -var _ protoreflect.Message = (*fastReflection_Operation)(nil) +var _ protoreflect.Message = (*fastReflection_MarketMap)(nil) -type fastReflection_Operation Operation +type fastReflection_MarketMap MarketMap -func (x *Operation) ProtoReflect() protoreflect.Message { - return (*fastReflection_Operation)(x) +func (x *MarketMap) ProtoReflect() protoreflect.Message { + return (*fastReflection_MarketMap)(x) } -func (x *Operation) slowProtoReflect() protoreflect.Message { +func (x *MarketMap) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_market_proto_msgTypes[3] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -1677,43 +2039,43 @@ func (x *Operation) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_Operation_messageType fastReflection_Operation_messageType -var _ protoreflect.MessageType = fastReflection_Operation_messageType{} +var _fastReflection_MarketMap_messageType fastReflection_MarketMap_messageType +var _ protoreflect.MessageType = fastReflection_MarketMap_messageType{} -type fastReflection_Operation_messageType struct{} +type fastReflection_MarketMap_messageType struct{} -func (x fastReflection_Operation_messageType) Zero() protoreflect.Message { - return (*fastReflection_Operation)(nil) +func (x fastReflection_MarketMap_messageType) Zero() protoreflect.Message { + return (*fastReflection_MarketMap)(nil) } -func (x fastReflection_Operation_messageType) New() protoreflect.Message { - return new(fastReflection_Operation) +func (x fastReflection_MarketMap_messageType) New() protoreflect.Message { + return new(fastReflection_MarketMap) } -func (x fastReflection_Operation_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Operation +func (x fastReflection_MarketMap_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MarketMap } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_Operation) Descriptor() protoreflect.MessageDescriptor { - return md_Operation +func (x *fastReflection_MarketMap) Descriptor() protoreflect.MessageDescriptor { + return md_MarketMap } // 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_Operation) Type() protoreflect.MessageType { - return _fastReflection_Operation_messageType +func (x *fastReflection_MarketMap) Type() protoreflect.MessageType { + return _fastReflection_MarketMap_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_Operation) New() protoreflect.Message { - return new(fastReflection_Operation) +func (x *fastReflection_MarketMap) New() protoreflect.Message { + return new(fastReflection_MarketMap) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_Operation) Interface() protoreflect.ProtoMessage { - return (*Operation)(x) +func (x *fastReflection_MarketMap) Interface() protoreflect.ProtoMessage { + return (*MarketMap)(x) } // Range iterates over every populated field in an undefined order, @@ -1721,22 +2083,10 @@ func (x *fastReflection_Operation) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_Operation) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.CurrencyPair != nil { - value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - if !f(fd_Operation_currency_pair, value) { - return - } - } - if x.Invert != false { - value := protoreflect.ValueOfBool(x.Invert) - if !f(fd_Operation_invert, value) { - return - } - } - if x.Provider != "" { - value := protoreflect.ValueOfString(x.Provider) - if !f(fd_Operation_provider, value) { +func (x *fastReflection_MarketMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.Markets) != 0 { + value := protoreflect.ValueOfMap(&_MarketMap_1_map{m: &x.Markets}) + if !f(fd_MarketMap_markets, value) { return } } @@ -1753,19 +2103,15 @@ func (x *fastReflection_Operation) Range(f func(protoreflect.FieldDescriptor, pr // 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_Operation) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MarketMap) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.Operation.currency_pair": - return x.CurrencyPair != nil - case "slinky.marketmap.v1.Operation.invert": - return x.Invert != false - case "slinky.marketmap.v1.Operation.provider": - return x.Provider != "" + case "slinky.marketmap.v1.MarketMap.markets": + return len(x.Markets) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Operation")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Operation does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap does not contain field %s", fd.FullName())) } } @@ -1775,19 +2121,15 @@ func (x *fastReflection_Operation) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Operation) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MarketMap) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.Operation.currency_pair": - x.CurrencyPair = nil - case "slinky.marketmap.v1.Operation.invert": - x.Invert = false - case "slinky.marketmap.v1.Operation.provider": - x.Provider = "" + case "slinky.marketmap.v1.MarketMap.markets": + x.Markets = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Operation")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Operation does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap does not contain field %s", fd.FullName())) } } @@ -1797,22 +2139,19 @@ func (x *fastReflection_Operation) Clear(fd protoreflect.FieldDescriptor) { // 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_Operation) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketMap) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.Operation.currency_pair": - value := x.CurrencyPair - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.marketmap.v1.Operation.invert": - value := x.Invert - return protoreflect.ValueOfBool(value) - case "slinky.marketmap.v1.Operation.provider": - value := x.Provider - return protoreflect.ValueOfString(value) + case "slinky.marketmap.v1.MarketMap.markets": + if len(x.Markets) == 0 { + return protoreflect.ValueOfMap(&_MarketMap_1_map{}) + } + mapValue := &_MarketMap_1_map{m: &x.Markets} + return protoreflect.ValueOfMap(mapValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Operation")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Operation does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap does not contain field %s", descriptor.FullName())) } } @@ -1826,19 +2165,17 @@ func (x *fastReflection_Operation) Get(descriptor protoreflect.FieldDescriptor) // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Operation) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MarketMap) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.Operation.currency_pair": - x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) - case "slinky.marketmap.v1.Operation.invert": - x.Invert = value.Bool() - case "slinky.marketmap.v1.Operation.provider": - x.Provider = value.Interface().(string) + case "slinky.marketmap.v1.MarketMap.markets": + mv := value.Map() + cmv := mv.(*_MarketMap_1_map) + x.Markets = *cmv.m default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Operation")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Operation does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap does not contain field %s", fd.FullName())) } } @@ -1852,52 +2189,45 @@ func (x *fastReflection_Operation) Set(fd protoreflect.FieldDescriptor, value pr // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Operation) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketMap) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Operation.currency_pair": - if x.CurrencyPair == nil { - x.CurrencyPair = new(v1.CurrencyPair) + case "slinky.marketmap.v1.MarketMap.markets": + if x.Markets == nil { + x.Markets = make(map[string]*Market) } - return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - case "slinky.marketmap.v1.Operation.invert": - panic(fmt.Errorf("field invert of message slinky.marketmap.v1.Operation is not mutable")) - case "slinky.marketmap.v1.Operation.provider": - panic(fmt.Errorf("field provider of message slinky.marketmap.v1.Operation is not mutable")) + value := &_MarketMap_1_map{m: &x.Markets} + return protoreflect.ValueOfMap(value) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Operation")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Operation does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_Operation) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketMap) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Operation.currency_pair": - m := new(v1.CurrencyPair) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.marketmap.v1.Operation.invert": - return protoreflect.ValueOfBool(false) - case "slinky.marketmap.v1.Operation.provider": - return protoreflect.ValueOfString("") + case "slinky.marketmap.v1.MarketMap.markets": + m := make(map[string]*Market) + return protoreflect.ValueOfMap(&_MarketMap_1_map{m: &m}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Operation")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) } - panic(fmt.Errorf("message slinky.marketmap.v1.Operation does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_Operation) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MarketMap) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Operation", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MarketMap", d.FullName())) } panic("unreachable") } @@ -1905,7 +2235,7 @@ func (x *fastReflection_Operation) WhichOneof(d protoreflect.OneofDescriptor) pr // 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_Operation) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MarketMap) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1916,7 +2246,7 @@ func (x *fastReflection_Operation) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Operation) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MarketMap) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1928,7 +2258,7 @@ func (x *fastReflection_Operation) SetUnknown(fields protoreflect.RawFields) { // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_Operation) IsValid() bool { +func (x *fastReflection_MarketMap) IsValid() bool { return x != nil } @@ -1938,9 +2268,9 @@ func (x *fastReflection_Operation) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_Operation) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MarketMap) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Operation) + x := input.Message.Interface().(*MarketMap) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1952,16 +2282,31 @@ func (x *fastReflection_Operation) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.CurrencyPair != nil { - l = options.Size(x.CurrencyPair) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Invert { - n += 2 - } - l = len(x.Provider) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.Markets) > 0 { + SiZeMaP := func(k string, v *Market) { + l := 0 + if v != nil { + l = options.Size(v) + } + l += 1 + runtime.Sov(uint64(l)) + mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l + n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) + } + if options.Deterministic { + sortme := make([]string, 0, len(x.Markets)) + for k := range x.Markets { + sortme = append(sortme, k) + } + sort.Strings(sortme) + for _, k := range sortme { + v := x.Markets[k] + SiZeMaP(k, v) + } + } else { + for k, v := range x.Markets { + SiZeMaP(k, v) + } + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -1973,7 +2318,7 @@ func (x *fastReflection_Operation) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Operation) + x := input.Message.Interface().(*MarketMap) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1992,2399 +2337,108 @@ func (x *fastReflection_Operation) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Provider) > 0 { - i -= len(x.Provider) - copy(dAtA[i:], x.Provider) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Provider))) - i-- - dAtA[i] = 0x1a - } - if x.Invert { - i-- - if x.Invert { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - if x.CurrencyPair != nil { - encoded, err := options.Marshal(x.CurrencyPair) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Operation) - 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: Operation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Operation: 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 CurrencyPair", 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.CurrencyPair == nil { - x.CurrencyPair = &v1.CurrencyPair{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Invert", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Invert = bool(v != 0) - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Provider", 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.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) + if len(x.Markets) > 0 { + MaRsHaLmAp := func(k string, v *Market) (protoiface.MarshalOutput, error) { + baseI := i + encoded, err := options.Marshal(v) 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]...) + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err } - iNdEx += skippy + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0xa + return protoiface.MarshalOutput{}, nil } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_Paths_1_list)(nil) - -type _Paths_1_list struct { - list *[]*Path -} - -func (x *_Paths_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Paths_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_Paths_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Path) - (*x.list)[i] = concreteValue -} - -func (x *_Paths_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Path) - *x.list = append(*x.list, concreteValue) -} - -func (x *_Paths_1_list) AppendMutable() protoreflect.Value { - v := new(Path) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Paths_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_Paths_1_list) NewElement() protoreflect.Value { - v := new(Path) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Paths_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_Paths protoreflect.MessageDescriptor - fd_Paths_paths protoreflect.FieldDescriptor -) - -func init() { - file_slinky_marketmap_v1_market_proto_init() - md_Paths = File_slinky_marketmap_v1_market_proto.Messages().ByName("Paths") - fd_Paths_paths = md_Paths.Fields().ByName("paths") -} - -var _ protoreflect.Message = (*fastReflection_Paths)(nil) - -type fastReflection_Paths Paths - -func (x *Paths) ProtoReflect() protoreflect.Message { - return (*fastReflection_Paths)(x) -} - -func (x *Paths) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[4] - 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_Paths_messageType fastReflection_Paths_messageType -var _ protoreflect.MessageType = fastReflection_Paths_messageType{} - -type fastReflection_Paths_messageType struct{} - -func (x fastReflection_Paths_messageType) Zero() protoreflect.Message { - return (*fastReflection_Paths)(nil) -} -func (x fastReflection_Paths_messageType) New() protoreflect.Message { - return new(fastReflection_Paths) -} -func (x fastReflection_Paths_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Paths -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Paths) Descriptor() protoreflect.MessageDescriptor { - return md_Paths -} - -// 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_Paths) Type() protoreflect.MessageType { - return _fastReflection_Paths_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Paths) New() protoreflect.Message { - return new(fastReflection_Paths) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Paths) Interface() protoreflect.ProtoMessage { - return (*Paths)(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_Paths) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Paths) != 0 { - value := protoreflect.ValueOfList(&_Paths_1_list{list: &x.Paths}) - if !f(fd_Paths_paths, 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_Paths) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.marketmap.v1.Paths.paths": - return len(x.Paths) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Paths")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Paths 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_Paths) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.marketmap.v1.Paths.paths": - x.Paths = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Paths")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Paths 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_Paths) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.marketmap.v1.Paths.paths": - if len(x.Paths) == 0 { - return protoreflect.ValueOfList(&_Paths_1_list{}) - } - listValue := &_Paths_1_list{list: &x.Paths} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Paths")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Paths 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_Paths) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.marketmap.v1.Paths.paths": - lv := value.List() - clv := lv.(*_Paths_1_list) - x.Paths = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Paths")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Paths 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_Paths) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.marketmap.v1.Paths.paths": - if x.Paths == nil { - x.Paths = []*Path{} - } - value := &_Paths_1_list{list: &x.Paths} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Paths")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Paths 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_Paths) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.marketmap.v1.Paths.paths": - list := []*Path{} - return protoreflect.ValueOfList(&_Paths_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Paths")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Paths 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_Paths) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Paths", 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_Paths) 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_Paths) 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_Paths) 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_Paths) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Paths) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Paths) > 0 { - for _, e := range x.Paths { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Paths) - 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.Paths) > 0 { - for iNdEx := len(x.Paths) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Paths[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Paths) - 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: Paths: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Paths: 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 Paths", 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.Paths = append(x.Paths, &Path{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Paths[len(x.Paths)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.List = (*_Providers_1_list)(nil) - -type _Providers_1_list struct { - list *[]*ProviderConfig -} - -func (x *_Providers_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Providers_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_Providers_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*ProviderConfig) - (*x.list)[i] = concreteValue -} - -func (x *_Providers_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*ProviderConfig) - *x.list = append(*x.list, concreteValue) -} - -func (x *_Providers_1_list) AppendMutable() protoreflect.Value { - v := new(ProviderConfig) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Providers_1_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_Providers_1_list) NewElement() protoreflect.Value { - v := new(ProviderConfig) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Providers_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_Providers protoreflect.MessageDescriptor - fd_Providers_providers protoreflect.FieldDescriptor -) - -func init() { - file_slinky_marketmap_v1_market_proto_init() - md_Providers = File_slinky_marketmap_v1_market_proto.Messages().ByName("Providers") - fd_Providers_providers = md_Providers.Fields().ByName("providers") -} - -var _ protoreflect.Message = (*fastReflection_Providers)(nil) - -type fastReflection_Providers Providers - -func (x *Providers) ProtoReflect() protoreflect.Message { - return (*fastReflection_Providers)(x) -} - -func (x *Providers) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[5] - 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_Providers_messageType fastReflection_Providers_messageType -var _ protoreflect.MessageType = fastReflection_Providers_messageType{} - -type fastReflection_Providers_messageType struct{} - -func (x fastReflection_Providers_messageType) Zero() protoreflect.Message { - return (*fastReflection_Providers)(nil) -} -func (x fastReflection_Providers_messageType) New() protoreflect.Message { - return new(fastReflection_Providers) -} -func (x fastReflection_Providers_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Providers -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Providers) Descriptor() protoreflect.MessageDescriptor { - return md_Providers -} - -// 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_Providers) Type() protoreflect.MessageType { - return _fastReflection_Providers_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Providers) New() protoreflect.Message { - return new(fastReflection_Providers) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Providers) Interface() protoreflect.ProtoMessage { - return (*Providers)(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_Providers) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Providers) != 0 { - value := protoreflect.ValueOfList(&_Providers_1_list{list: &x.Providers}) - if !f(fd_Providers_providers, 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_Providers) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.marketmap.v1.Providers.providers": - return len(x.Providers) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Providers")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Providers 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_Providers) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.marketmap.v1.Providers.providers": - x.Providers = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Providers")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Providers 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_Providers) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.marketmap.v1.Providers.providers": - if len(x.Providers) == 0 { - return protoreflect.ValueOfList(&_Providers_1_list{}) - } - listValue := &_Providers_1_list{list: &x.Providers} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Providers")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Providers 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_Providers) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.marketmap.v1.Providers.providers": - lv := value.List() - clv := lv.(*_Providers_1_list) - x.Providers = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Providers")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Providers 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_Providers) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.marketmap.v1.Providers.providers": - if x.Providers == nil { - x.Providers = []*ProviderConfig{} - } - value := &_Providers_1_list{list: &x.Providers} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Providers")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Providers 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_Providers) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.marketmap.v1.Providers.providers": - list := []*ProviderConfig{} - return protoreflect.ValueOfList(&_Providers_1_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Providers")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.Providers 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_Providers) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.Providers", 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_Providers) 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_Providers) 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_Providers) 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_Providers) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Providers) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Providers) > 0 { - for _, e := range x.Providers { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Providers) - 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.Providers) > 0 { - for iNdEx := len(x.Providers) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.Providers[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Providers) - 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: Providers: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Providers: 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 Providers", 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.Providers = append(x.Providers, &ProviderConfig{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Providers[len(x.Providers)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var _ protoreflect.Map = (*_MarketMap_1_map)(nil) - -type _MarketMap_1_map struct { - m *map[string]*Ticker -} - -func (x *_MarketMap_1_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_MarketMap_1_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_MarketMap_1_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_MarketMap_1_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_MarketMap_1_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_1_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Ticker) - (*x.m)[concreteKey] = concreteValue -} - -func (x *_MarketMap_1_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if ok { - return protoreflect.ValueOfMessage(v.ProtoReflect()) - } - newValue := new(Ticker) - (*x.m)[concreteKey] = newValue - return protoreflect.ValueOfMessage(newValue.ProtoReflect()) -} - -func (x *_MarketMap_1_map) NewValue() protoreflect.Value { - v := new(Ticker) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_1_map) IsValid() bool { - return x.m != nil -} - -var _ protoreflect.Map = (*_MarketMap_2_map)(nil) - -type _MarketMap_2_map struct { - m *map[string]*Paths -} - -func (x *_MarketMap_2_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_MarketMap_2_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_MarketMap_2_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_MarketMap_2_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_MarketMap_2_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_2_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Paths) - (*x.m)[concreteKey] = concreteValue -} - -func (x *_MarketMap_2_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if ok { - return protoreflect.ValueOfMessage(v.ProtoReflect()) - } - newValue := new(Paths) - (*x.m)[concreteKey] = newValue - return protoreflect.ValueOfMessage(newValue.ProtoReflect()) -} - -func (x *_MarketMap_2_map) NewValue() protoreflect.Value { - v := new(Paths) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_2_map) IsValid() bool { - return x.m != nil -} - -var _ protoreflect.Map = (*_MarketMap_3_map)(nil) - -type _MarketMap_3_map struct { - m *map[string]*Providers -} - -func (x *_MarketMap_3_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_MarketMap_3_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_MarketMap_3_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_MarketMap_3_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_MarketMap_3_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_3_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Providers) - (*x.m)[concreteKey] = concreteValue -} - -func (x *_MarketMap_3_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if ok { - return protoreflect.ValueOfMessage(v.ProtoReflect()) - } - newValue := new(Providers) - (*x.m)[concreteKey] = newValue - return protoreflect.ValueOfMessage(newValue.ProtoReflect()) -} - -func (x *_MarketMap_3_map) NewValue() protoreflect.Value { - v := new(Providers) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_3_map) IsValid() bool { - return x.m != nil -} - -var ( - md_MarketMap protoreflect.MessageDescriptor - fd_MarketMap_tickers protoreflect.FieldDescriptor - fd_MarketMap_paths protoreflect.FieldDescriptor - fd_MarketMap_providers protoreflect.FieldDescriptor - fd_MarketMap_aggregation_type protoreflect.FieldDescriptor -) - -func init() { - file_slinky_marketmap_v1_market_proto_init() - md_MarketMap = File_slinky_marketmap_v1_market_proto.Messages().ByName("MarketMap") - fd_MarketMap_tickers = md_MarketMap.Fields().ByName("tickers") - fd_MarketMap_paths = md_MarketMap.Fields().ByName("paths") - fd_MarketMap_providers = md_MarketMap.Fields().ByName("providers") - fd_MarketMap_aggregation_type = md_MarketMap.Fields().ByName("aggregation_type") -} - -var _ protoreflect.Message = (*fastReflection_MarketMap)(nil) - -type fastReflection_MarketMap MarketMap - -func (x *MarketMap) ProtoReflect() protoreflect.Message { - return (*fastReflection_MarketMap)(x) -} - -func (x *MarketMap) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MarketMap_messageType fastReflection_MarketMap_messageType -var _ protoreflect.MessageType = fastReflection_MarketMap_messageType{} - -type fastReflection_MarketMap_messageType struct{} - -func (x fastReflection_MarketMap_messageType) Zero() protoreflect.Message { - return (*fastReflection_MarketMap)(nil) -} -func (x fastReflection_MarketMap_messageType) New() protoreflect.Message { - return new(fastReflection_MarketMap) -} -func (x fastReflection_MarketMap_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMap -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MarketMap) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMap -} - -// 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_MarketMap) Type() protoreflect.MessageType { - return _fastReflection_MarketMap_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MarketMap) New() protoreflect.Message { - return new(fastReflection_MarketMap) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MarketMap) Interface() protoreflect.ProtoMessage { - return (*MarketMap)(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_MarketMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Tickers) != 0 { - value := protoreflect.ValueOfMap(&_MarketMap_1_map{m: &x.Tickers}) - if !f(fd_MarketMap_tickers, value) { - return - } - } - if len(x.Paths) != 0 { - value := protoreflect.ValueOfMap(&_MarketMap_2_map{m: &x.Paths}) - if !f(fd_MarketMap_paths, value) { - return - } - } - if len(x.Providers) != 0 { - value := protoreflect.ValueOfMap(&_MarketMap_3_map{m: &x.Providers}) - if !f(fd_MarketMap_providers, value) { - return - } - } - if x.AggregationType != 0 { - value := protoreflect.ValueOfEnum((protoreflect.EnumNumber)(x.AggregationType)) - if !f(fd_MarketMap_aggregation_type, 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_MarketMap) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.marketmap.v1.MarketMap.tickers": - return len(x.Tickers) != 0 - case "slinky.marketmap.v1.MarketMap.paths": - return len(x.Paths) != 0 - case "slinky.marketmap.v1.MarketMap.providers": - return len(x.Providers) != 0 - case "slinky.marketmap.v1.MarketMap.aggregation_type": - return x.AggregationType != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_MarketMap) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.marketmap.v1.MarketMap.tickers": - x.Tickers = nil - case "slinky.marketmap.v1.MarketMap.paths": - x.Paths = nil - case "slinky.marketmap.v1.MarketMap.providers": - x.Providers = nil - case "slinky.marketmap.v1.MarketMap.aggregation_type": - x.AggregationType = 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_MarketMap) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.marketmap.v1.MarketMap.tickers": - if len(x.Tickers) == 0 { - return protoreflect.ValueOfMap(&_MarketMap_1_map{}) - } - mapValue := &_MarketMap_1_map{m: &x.Tickers} - return protoreflect.ValueOfMap(mapValue) - case "slinky.marketmap.v1.MarketMap.paths": - if len(x.Paths) == 0 { - return protoreflect.ValueOfMap(&_MarketMap_2_map{}) - } - mapValue := &_MarketMap_2_map{m: &x.Paths} - return protoreflect.ValueOfMap(mapValue) - case "slinky.marketmap.v1.MarketMap.providers": - if len(x.Providers) == 0 { - return protoreflect.ValueOfMap(&_MarketMap_3_map{}) - } - mapValue := &_MarketMap_3_map{m: &x.Providers} - return protoreflect.ValueOfMap(mapValue) - case "slinky.marketmap.v1.MarketMap.aggregation_type": - value := x.AggregationType - return protoreflect.ValueOfEnum((protoreflect.EnumNumber)(value)) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_MarketMap) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.marketmap.v1.MarketMap.tickers": - mv := value.Map() - cmv := mv.(*_MarketMap_1_map) - x.Tickers = *cmv.m - case "slinky.marketmap.v1.MarketMap.paths": - mv := value.Map() - cmv := mv.(*_MarketMap_2_map) - x.Paths = *cmv.m - case "slinky.marketmap.v1.MarketMap.providers": - mv := value.Map() - cmv := mv.(*_MarketMap_3_map) - x.Providers = *cmv.m - case "slinky.marketmap.v1.MarketMap.aggregation_type": - x.AggregationType = (AggregationType)(value.Enum()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_MarketMap) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.marketmap.v1.MarketMap.tickers": - if x.Tickers == nil { - x.Tickers = make(map[string]*Ticker) - } - value := &_MarketMap_1_map{m: &x.Tickers} - return protoreflect.ValueOfMap(value) - case "slinky.marketmap.v1.MarketMap.paths": - if x.Paths == nil { - x.Paths = make(map[string]*Paths) - } - value := &_MarketMap_2_map{m: &x.Paths} - return protoreflect.ValueOfMap(value) - case "slinky.marketmap.v1.MarketMap.providers": - if x.Providers == nil { - x.Providers = make(map[string]*Providers) - } - value := &_MarketMap_3_map{m: &x.Providers} - return protoreflect.ValueOfMap(value) - case "slinky.marketmap.v1.MarketMap.aggregation_type": - panic(fmt.Errorf("field aggregation_type of message slinky.marketmap.v1.MarketMap is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_MarketMap) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.marketmap.v1.MarketMap.tickers": - m := make(map[string]*Ticker) - return protoreflect.ValueOfMap(&_MarketMap_1_map{m: &m}) - case "slinky.marketmap.v1.MarketMap.paths": - m := make(map[string]*Paths) - return protoreflect.ValueOfMap(&_MarketMap_2_map{m: &m}) - case "slinky.marketmap.v1.MarketMap.providers": - m := make(map[string]*Providers) - return protoreflect.ValueOfMap(&_MarketMap_3_map{m: &m}) - case "slinky.marketmap.v1.MarketMap.aggregation_type": - return protoreflect.ValueOfEnum(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.marketmap.v1.MarketMap 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_MarketMap) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MarketMap", 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_MarketMap) 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_MarketMap) 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_MarketMap) 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_MarketMap) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MarketMap) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Tickers) > 0 { - SiZeMaP := func(k string, v *Ticker) { - l := 0 - if v != nil { - l = options.Size(v) - } - l += 1 + runtime.Sov(uint64(l)) - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.Tickers)) - for k := range x.Tickers { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.Tickers[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.Tickers { - SiZeMaP(k, v) - } - } - } - if len(x.Paths) > 0 { - SiZeMaP := func(k string, v *Paths) { - l := 0 - if v != nil { - l = options.Size(v) - } - l += 1 + runtime.Sov(uint64(l)) - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.Paths)) - for k := range x.Paths { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.Paths[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.Paths { - SiZeMaP(k, v) - } - } - } - if len(x.Providers) > 0 { - SiZeMaP := func(k string, v *Providers) { - l := 0 - if v != nil { - l = options.Size(v) - } - l += 1 + runtime.Sov(uint64(l)) - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.Providers)) - for k := range x.Providers { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.Providers[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.Providers { - SiZeMaP(k, v) - } - } - } - if x.AggregationType != 0 { - n += 1 + runtime.Sov(uint64(x.AggregationType)) - } - 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().(*MarketMap) - 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.AggregationType != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.AggregationType)) - i-- - dAtA[i] = 0x20 - } - if len(x.Providers) > 0 { - MaRsHaLmAp := func(k string, v *Providers) (protoiface.MarshalOutput, error) { - baseI := i - encoded, err := options.Marshal(v) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForProviders := make([]string, 0, len(x.Providers)) - for k := range x.Providers { - keysForProviders = append(keysForProviders, string(k)) - } - sort.Slice(keysForProviders, func(i, j int) bool { - return keysForProviders[i] < keysForProviders[j] - }) - for iNdEx := len(keysForProviders) - 1; iNdEx >= 0; iNdEx-- { - v := x.Providers[string(keysForProviders[iNdEx])] - out, err := MaRsHaLmAp(keysForProviders[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.Providers { - v := x.Providers[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - if len(x.Paths) > 0 { - MaRsHaLmAp := func(k string, v *Paths) (protoiface.MarshalOutput, error) { - baseI := i - encoded, err := options.Marshal(v) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForPaths := make([]string, 0, len(x.Paths)) - for k := range x.Paths { - keysForPaths = append(keysForPaths, string(k)) - } - sort.Slice(keysForPaths, func(i, j int) bool { - return keysForPaths[i] < keysForPaths[j] - }) - for iNdEx := len(keysForPaths) - 1; iNdEx >= 0; iNdEx-- { - v := x.Paths[string(keysForPaths[iNdEx])] - out, err := MaRsHaLmAp(keysForPaths[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.Paths { - v := x.Paths[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - if len(x.Tickers) > 0 { - MaRsHaLmAp := func(k string, v *Ticker) (protoiface.MarshalOutput, error) { - baseI := i - encoded, err := options.Marshal(v) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForTickers := make([]string, 0, len(x.Tickers)) - for k := range x.Tickers { - keysForTickers = append(keysForTickers, string(k)) - } - sort.Slice(keysForTickers, func(i, j int) bool { - return keysForTickers[i] < keysForTickers[j] - }) - for iNdEx := len(keysForTickers) - 1; iNdEx >= 0; iNdEx-- { - v := x.Tickers[string(keysForTickers[iNdEx])] - out, err := MaRsHaLmAp(keysForTickers[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.Tickers { - v := x.Tickers[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - 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().(*MarketMap) - 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: MarketMap: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMap: 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 Tickers", 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.Tickers == nil { - x.Tickers = make(map[string]*Ticker) - } - var mapkey string - var mapvalue *Ticker - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey 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++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapkey > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen 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++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postmsgIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapvalue = &Ticker{} - if err := options.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - 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) > postIndex { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - x.Tickers[mapkey] = mapvalue - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Paths", 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.Paths == nil { - x.Paths = make(map[string]*Paths) + if options.Deterministic { + keysForMarkets := make([]string, 0, len(x.Markets)) + for k := range x.Markets { + keysForMarkets = append(keysForMarkets, string(k)) } - var mapkey string - var mapvalue *Paths - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey 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++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapkey > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen 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++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postmsgIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapvalue = &Paths{} - if err := options.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - 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) > postIndex { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - iNdEx += skippy + sort.Slice(keysForMarkets, func(i, j int) bool { + return keysForMarkets[i] < keysForMarkets[j] + }) + for iNdEx := len(keysForMarkets) - 1; iNdEx >= 0; iNdEx-- { + v := x.Markets[string(keysForMarkets[iNdEx])] + out, err := MaRsHaLmAp(keysForMarkets[iNdEx], v) + if err != nil { + return out, err } } - x.Paths[mapkey] = mapvalue - iNdEx = postIndex - case 3: + } else { + for k := range x.Markets { + v := x.Markets[k] + out, err := MaRsHaLmAp(k, v) + if err != nil { + return out, err + } + } + } + } + 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().(*MarketMap) + 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: MarketMap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMap: 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 Providers", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -4411,11 +2465,11 @@ func (x *fastReflection_MarketMap) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.Providers == nil { - x.Providers = make(map[string]*Providers) + if x.Markets == nil { + x.Markets = make(map[string]*Market) } var mapkey string - var mapvalue *Providers + var mapvalue *Market for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -4489,7 +2543,7 @@ func (x *fastReflection_MarketMap) ProtoMethods() *protoiface.Methods { if postmsgIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - mapvalue = &Providers{} + mapvalue = &Market{} if err := options.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } @@ -4509,27 +2563,8 @@ func (x *fastReflection_MarketMap) ProtoMethods() *protoiface.Methods { iNdEx += skippy } } - x.Providers[mapkey] = mapvalue + x.Markets[mapkey] = mapvalue iNdEx = postIndex - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AggregationType", wireType) - } - x.AggregationType = 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.AggregationType |= AggregationType(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -4578,63 +2613,52 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// AggregationType is the type of aggregation that will be used to aggregate the -// prices of the tickers. -type AggregationType int32 +// Market encapsulates a Ticker and its provider-specific configuration. +type Market struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields -const ( - // UNKOWN_AGGREGATION_TYPE is the default value for the aggregation type. - AggregationType_UNKNOWN_AGGREGATION_TYPE AggregationType = 0 - // IndexPriceAggregation is the type of aggregation that will be used to - // aggregate the prices of the tickers. Specifically, this converts the prices - // either directly or using the index price to a common currency pair. - AggregationType_INDEX_PRICE_AGGREGATION AggregationType = 1 - // StandardMedianAggregation is the type of aggregation that will be used to - // aggregate the prices of the tickers. Specifically, this converts the prices - // to a common currency pair and then takes the median of the prices. No - // conversions are done if the prices are already in the common currency pair. - AggregationType_STANDARD_MEDIAN_AGGREGATION AggregationType = 2 -) + // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The + // price feed is scaled to a number of decimal places and has a minimum number + // of providers required to consider the ticker valid. + Ticker *Ticker `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"` + // ProviderConfigs is the list of provider-specific configs for this Market. + ProviderConfigs []*ProviderConfig `protobuf:"bytes,2,rep,name=provider_configs,json=providerConfigs,proto3" json:"provider_configs,omitempty"` +} -// Enum value maps for AggregationType. -var ( - AggregationType_name = map[int32]string{ - 0: "UNKNOWN_AGGREGATION_TYPE", - 1: "INDEX_PRICE_AGGREGATION", - 2: "STANDARD_MEDIAN_AGGREGATION", - } - AggregationType_value = map[string]int32{ - "UNKNOWN_AGGREGATION_TYPE": 0, - "INDEX_PRICE_AGGREGATION": 1, - "STANDARD_MEDIAN_AGGREGATION": 2, +func (x *Market) Reset() { + *x = Market{} + if protoimpl.UnsafeEnabled { + mi := &file_slinky_marketmap_v1_market_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } -) - -func (x AggregationType) Enum() *AggregationType { - p := new(AggregationType) - *p = x - return p } -func (x AggregationType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +func (x *Market) String() string { + return protoimpl.X.MessageStringOf(x) } -func (AggregationType) Descriptor() protoreflect.EnumDescriptor { - return file_slinky_marketmap_v1_market_proto_enumTypes[0].Descriptor() -} +func (*Market) ProtoMessage() {} -func (AggregationType) Type() protoreflect.EnumType { - return &file_slinky_marketmap_v1_market_proto_enumTypes[0] +// Deprecated: Use Market.ProtoReflect.Descriptor instead. +func (*Market) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{0} } -func (x AggregationType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) +func (x *Market) GetTicker() *Ticker { + if x != nil { + return x.Ticker + } + return nil } -// Deprecated: Use AggregationType.Descriptor instead. -func (AggregationType) EnumDescriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{0} +func (x *Market) GetProviderConfigs() []*ProviderConfig { + if x != nil { + return x.ProviderConfigs + } + return nil } // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price @@ -4664,7 +2688,7 @@ type Ticker struct { func (x *Ticker) Reset() { *x = Ticker{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[0] + mi := &file_slinky_marketmap_v1_market_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4678,7 +2702,7 @@ func (*Ticker) ProtoMessage() {} // Deprecated: Use Ticker.ProtoReflect.Descriptor instead. func (*Ticker) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{0} + return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{1} } func (x *Ticker) GetCurrencyPair() *v1.CurrencyPair { @@ -4728,12 +2752,23 @@ type ProviderConfig struct { // The off-chain ticker is unique to a given provider and is used to fetch the // price of the ticker from the provider. OffChainTicker string `protobuf:"bytes,2,opt,name=off_chain_ticker,json=offChainTicker,proto3" json:"off_chain_ticker,omitempty"` + // NormalizeByPair is the currency pair for this ticker to be normalized by. + // For example, if the desired Ticker is BTD/USD, this market could be reached + // using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is + // optional and nullable. + NormalizeByPair *v1.CurrencyPair `protobuf:"bytes,3,opt,name=normalize_by_pair,json=normalizeByPair,proto3" json:"normalize_by_pair,omitempty"` + // Invert is a boolean indicating if the BASE and QUOTE of the market should + // be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE + Invert bool `protobuf:"varint,4,opt,name=invert,proto3" json:"invert,omitempty"` + // MetadataJSON is a string of JSON that encodes any extra configuration + // for the given provider config. + Metadata_JSON string `protobuf:"bytes,15,opt,name=metadata_JSON,json=metadataJSON,proto3" json:"metadata_JSON,omitempty"` } func (x *ProviderConfig) Reset() { *x = ProviderConfig{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[1] + mi := &file_slinky_marketmap_v1_market_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4747,7 +2782,7 @@ func (*ProviderConfig) ProtoMessage() {} // Deprecated: Use ProviderConfig.ProtoReflect.Descriptor instead. func (*ProviderConfig) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{1} + return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{2} } func (x *ProviderConfig) GetName() string { @@ -4764,197 +2799,42 @@ func (x *ProviderConfig) GetOffChainTicker() string { return "" } -// Path is the list of convertable markets that will be used to convert the -// prices of a set of tickers to a common ticker. -type Path struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Operations is an ordered list of operations that will be taken. These must - // be topologically sorted to ensure that the conversion is possible i.e. DAG. - Operations []*Operation `protobuf:"bytes,1,rep,name=operations,proto3" json:"operations,omitempty"` -} - -func (x *Path) Reset() { - *x = Path{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Path) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Path) ProtoMessage() {} - -// Deprecated: Use Path.ProtoReflect.Descriptor instead. -func (*Path) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{2} -} - -func (x *Path) GetOperations() []*Operation { - if x != nil { - return x.Operations - } - return nil -} - -// Operation represents the operation configuration for a given ticker. -type Operation struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // CurrencyPair is the on-chain currency pair for this ticker. - CurrencyPair *v1.CurrencyPair `protobuf:"bytes,1,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair,omitempty"` - // Invert is a boolean that indicates whether the price of the ticker should - // be inverted. - Invert bool `protobuf:"varint,2,opt,name=invert,proto3" json:"invert,omitempty"` - // Provider is the name of the provider that will be used to fetch the price - // of the ticker. - Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (x *Operation) Reset() { - *x = Operation{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Operation) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Operation) ProtoMessage() {} - -// Deprecated: Use Operation.ProtoReflect.Descriptor instead. -func (*Operation) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{3} -} - -func (x *Operation) GetCurrencyPair() *v1.CurrencyPair { +func (x *ProviderConfig) GetNormalizeByPair() *v1.CurrencyPair { if x != nil { - return x.CurrencyPair + return x.NormalizeByPair } return nil } -func (x *Operation) GetInvert() bool { +func (x *ProviderConfig) GetInvert() bool { if x != nil { return x.Invert } return false } -func (x *Operation) GetProvider() string { +func (x *ProviderConfig) GetMetadata_JSON() string { if x != nil { - return x.Provider + return x.Metadata_JSON } return "" } -type Paths struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - Paths []*Path `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"` -} - -func (x *Paths) Reset() { - *x = Paths{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Paths) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Paths) ProtoMessage() {} - -// Deprecated: Use Paths.ProtoReflect.Descriptor instead. -func (*Paths) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{4} -} - -func (x *Paths) GetPaths() []*Path { - if x != nil { - return x.Paths - } - return nil -} - -type Providers struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Providers is the list of provider configurations for the given ticker. - Providers []*ProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers,omitempty"` -} - -func (x *Providers) Reset() { - *x = Providers{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Providers) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Providers) ProtoMessage() {} - -// Deprecated: Use Providers.ProtoReflect.Descriptor instead. -func (*Providers) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{5} -} - -func (x *Providers) GetProviders() []*ProviderConfig { - if x != nil { - return x.Providers - } - return nil -} - +// MarketMap maps ticker strings to their Markets. type MarketMap struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Tickers is the full list of tickers and their associated configurations + // Markets is the full list of tickers and their associated configurations // to be stored on-chain. - Tickers map[string]*Ticker `protobuf:"bytes,1,rep,name=tickers,proto3" json:"tickers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Paths is a map from CurrencyPair to all paths that resolve to that pair - Paths map[string]*Paths `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Providers is a map from CurrencyPair to each of to provider-specific - // configs associated with it. - Providers map[string]*Providers `protobuf:"bytes,3,rep,name=providers,proto3" json:"providers,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // AggregationType is the type of aggregation that will be used to aggregate - // the prices of the tickers. - AggregationType AggregationType `protobuf:"varint,4,opt,name=aggregation_type,json=aggregationType,proto3,enum=slinky.marketmap.v1.AggregationType" json:"aggregation_type,omitempty"` + Markets map[string]*Market `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (x *MarketMap) Reset() { *x = MarketMap{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_market_proto_msgTypes[6] + mi := &file_slinky_marketmap_v1_market_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -4968,37 +2848,16 @@ func (*MarketMap) ProtoMessage() {} // Deprecated: Use MarketMap.ProtoReflect.Descriptor instead. func (*MarketMap) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{6} -} - -func (x *MarketMap) GetTickers() map[string]*Ticker { - if x != nil { - return x.Tickers - } - return nil -} - -func (x *MarketMap) GetPaths() map[string]*Paths { - if x != nil { - return x.Paths - } - return nil + return file_slinky_marketmap_v1_market_proto_rawDescGZIP(), []int{3} } -func (x *MarketMap) GetProviders() map[string]*Providers { +func (x *MarketMap) GetMarkets() map[string]*Market { if x != nil { - return x.Providers + return x.Markets } return nil } -func (x *MarketMap) GetAggregationType() AggregationType { - if x != nil { - return x.AggregationType - } - return AggregationType_UNKNOWN_AGGREGATION_TYPE -} - var File_slinky_marketmap_v1_market_proto protoreflect.FileDescriptor var file_slinky_marketmap_v1_market_proto_rawDesc = []byte{ @@ -5009,107 +2868,70 @@ var file_slinky_marketmap_v1_market_proto_rawDesc = []byte{ 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xe5, 0x01, 0x0a, 0x06, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x48, 0x0a, - 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, - 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, - 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, - 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, - 0x61, 0x6c, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x10, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, - 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x6d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0f, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4a, 0x53, 0x4f, 0x4e, - 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, 0x22, 0x4e, 0x0a, 0x0e, 0x50, 0x72, - 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, - 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, - 0x12, 0x28, 0x0a, 0x10, 0x6f, 0x66, 0x66, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x74, 0x69, - 0x63, 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x66, 0x66, 0x43, - 0x68, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x22, 0x4c, 0x0a, 0x04, 0x50, 0x61, - 0x74, 0x68, 0x12, 0x44, 0x0a, 0x0a, 0x6f, 0x70, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, - 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x6f, 0x70, - 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x89, 0x01, 0x0a, 0x09, 0x4f, 0x70, 0x65, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x48, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, - 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, - 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, 0xde, - 0x1f, 0x00, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, - 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x70, 0x72, 0x6f, 0x76, - 0x69, 0x64, 0x65, 0x72, 0x22, 0x3e, 0x0a, 0x05, 0x50, 0x61, 0x74, 0x68, 0x73, 0x12, 0x35, 0x0a, - 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x70, - 0x61, 0x74, 0x68, 0x73, 0x22, 0x54, 0x0a, 0x09, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, - 0x73, 0x12, 0x47, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x01, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x22, 0xda, 0x04, 0x0a, 0x09, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x4b, 0x0a, 0x07, 0x74, 0x69, 0x63, 0x6b, - 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x74, 0x69, - 0x63, 0x6b, 0x65, 0x72, 0x73, 0x12, 0x45, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x02, - 0x20, 0x03, 0x28, 0x0b, 0x32, 0x29, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x4d, 0x61, 0x70, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x12, 0x51, 0x0a, 0x09, - 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, - 0x2d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x2e, - 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x12, - 0x4f, 0x0a, 0x10, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x24, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, - 0x41, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x52, - 0x0f, 0x61, 0x67, 0x67, 0x72, 0x65, 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, - 0x1a, 0x57, 0x0a, 0x0c, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, - 0x65, 0x79, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x54, 0x0a, 0x0a, 0x50, 0x61, 0x74, - 0x68, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x30, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, - 0x61, 0x74, 0x68, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, - 0x5c, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x45, 0x6e, 0x74, 0x72, - 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, - 0x6b, 0x65, 0x79, 0x12, 0x34, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, + 0x74, 0x6f, 0x22, 0xa3, 0x01, 0x0a, 0x06, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x12, 0x39, 0x0a, + 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, + 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x54, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x76, + 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x08, 0x98, - 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, 0x2a, 0x6d, 0x0a, 0x0f, 0x41, 0x67, 0x67, 0x72, 0x65, - 0x67, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c, 0x0a, 0x18, 0x55, 0x4e, - 0x4b, 0x4e, 0x4f, 0x57, 0x4e, 0x5f, 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, 0x41, 0x54, 0x49, 0x4f, - 0x4e, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x10, 0x00, 0x12, 0x1b, 0x0a, 0x17, 0x49, 0x4e, 0x44, 0x45, - 0x58, 0x5f, 0x50, 0x52, 0x49, 0x43, 0x45, 0x5f, 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, 0x41, 0x54, - 0x49, 0x4f, 0x4e, 0x10, 0x01, 0x12, 0x1f, 0x0a, 0x1b, 0x53, 0x54, 0x41, 0x4e, 0x44, 0x41, 0x52, - 0x44, 0x5f, 0x4d, 0x45, 0x44, 0x49, 0x41, 0x4e, 0x5f, 0x41, 0x47, 0x47, 0x52, 0x45, 0x47, 0x41, - 0x54, 0x49, 0x4f, 0x4e, 0x10, 0x02, 0x42, 0xc6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x31, 0xca, - 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, - 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0f, 0x70, + 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x3a, 0x08, + 0x98, 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, 0x22, 0xe5, 0x01, 0x0a, 0x06, 0x54, 0x69, 0x63, + 0x6b, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, + 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, + 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, + 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, + 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, + 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x69, 0x6e, + 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x6d, 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, + 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, + 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, + 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x4a, 0x53, + 0x4f, 0x4e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0x4a, 0x53, 0x4f, 0x4e, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, + 0x22, 0xd6, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, + 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x28, 0x0a, 0x10, 0x6f, 0x66, 0x66, 0x5f, 0x63, + 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0e, 0x6f, 0x66, 0x66, 0x43, 0x68, 0x61, 0x69, 0x6e, 0x54, 0x69, 0x63, 0x6b, 0x65, + 0x72, 0x12, 0x49, 0x0a, 0x11, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x5f, 0x62, + 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, + 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x52, 0x0f, 0x6e, 0x6f, 0x72, + 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x42, 0x79, 0x50, 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, + 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x6e, + 0x76, 0x65, 0x72, 0x74, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x74, + 0x61, 0x64, 0x61, 0x74, 0x61, 0x4a, 0x53, 0x4f, 0x4e, 0x22, 0xbb, 0x01, 0x0a, 0x09, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x4b, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x2b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, + 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, + 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x57, 0x0a, 0x0c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x45, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x31, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x08, 0x98, + 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, 0x42, 0xc6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, + 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, + 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x13, 0x53, 0x6c, 0x69, + 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x31, + 0xca, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, + 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x53, 0x6c, 0x69, 0x6e, 0x6b, + 0x79, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x31, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -5124,40 +2946,27 @@ func file_slinky_marketmap_v1_market_proto_rawDescGZIP() []byte { return file_slinky_marketmap_v1_market_proto_rawDescData } -var file_slinky_marketmap_v1_market_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_slinky_marketmap_v1_market_proto_msgTypes = make([]protoimpl.MessageInfo, 10) +var file_slinky_marketmap_v1_market_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_slinky_marketmap_v1_market_proto_goTypes = []interface{}{ - (AggregationType)(0), // 0: slinky.marketmap.v1.AggregationType + (*Market)(nil), // 0: slinky.marketmap.v1.Market (*Ticker)(nil), // 1: slinky.marketmap.v1.Ticker (*ProviderConfig)(nil), // 2: slinky.marketmap.v1.ProviderConfig - (*Path)(nil), // 3: slinky.marketmap.v1.Path - (*Operation)(nil), // 4: slinky.marketmap.v1.Operation - (*Paths)(nil), // 5: slinky.marketmap.v1.Paths - (*Providers)(nil), // 6: slinky.marketmap.v1.Providers - (*MarketMap)(nil), // 7: slinky.marketmap.v1.MarketMap - nil, // 8: slinky.marketmap.v1.MarketMap.TickersEntry - nil, // 9: slinky.marketmap.v1.MarketMap.PathsEntry - nil, // 10: slinky.marketmap.v1.MarketMap.ProvidersEntry - (*v1.CurrencyPair)(nil), // 11: slinky.types.v1.CurrencyPair + (*MarketMap)(nil), // 3: slinky.marketmap.v1.MarketMap + nil, // 4: slinky.marketmap.v1.MarketMap.MarketsEntry + (*v1.CurrencyPair)(nil), // 5: slinky.types.v1.CurrencyPair } var file_slinky_marketmap_v1_market_proto_depIdxs = []int32{ - 11, // 0: slinky.marketmap.v1.Ticker.currency_pair:type_name -> slinky.types.v1.CurrencyPair - 4, // 1: slinky.marketmap.v1.Path.operations:type_name -> slinky.marketmap.v1.Operation - 11, // 2: slinky.marketmap.v1.Operation.currency_pair:type_name -> slinky.types.v1.CurrencyPair - 3, // 3: slinky.marketmap.v1.Paths.paths:type_name -> slinky.marketmap.v1.Path - 2, // 4: slinky.marketmap.v1.Providers.providers:type_name -> slinky.marketmap.v1.ProviderConfig - 8, // 5: slinky.marketmap.v1.MarketMap.tickers:type_name -> slinky.marketmap.v1.MarketMap.TickersEntry - 9, // 6: slinky.marketmap.v1.MarketMap.paths:type_name -> slinky.marketmap.v1.MarketMap.PathsEntry - 10, // 7: slinky.marketmap.v1.MarketMap.providers:type_name -> slinky.marketmap.v1.MarketMap.ProvidersEntry - 0, // 8: slinky.marketmap.v1.MarketMap.aggregation_type:type_name -> slinky.marketmap.v1.AggregationType - 1, // 9: slinky.marketmap.v1.MarketMap.TickersEntry.value:type_name -> slinky.marketmap.v1.Ticker - 5, // 10: slinky.marketmap.v1.MarketMap.PathsEntry.value:type_name -> slinky.marketmap.v1.Paths - 6, // 11: slinky.marketmap.v1.MarketMap.ProvidersEntry.value:type_name -> slinky.marketmap.v1.Providers - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 1, // 0: slinky.marketmap.v1.Market.ticker:type_name -> slinky.marketmap.v1.Ticker + 2, // 1: slinky.marketmap.v1.Market.provider_configs:type_name -> slinky.marketmap.v1.ProviderConfig + 5, // 2: slinky.marketmap.v1.Ticker.currency_pair:type_name -> slinky.types.v1.CurrencyPair + 5, // 3: slinky.marketmap.v1.ProviderConfig.normalize_by_pair:type_name -> slinky.types.v1.CurrencyPair + 4, // 4: slinky.marketmap.v1.MarketMap.markets:type_name -> slinky.marketmap.v1.MarketMap.MarketsEntry + 0, // 5: slinky.marketmap.v1.MarketMap.MarketsEntry.value:type_name -> slinky.marketmap.v1.Market + 6, // [6:6] is the sub-list for method output_type + 6, // [6:6] is the sub-list for method input_type + 6, // [6:6] is the sub-list for extension type_name + 6, // [6:6] is the sub-list for extension extendee + 0, // [0:6] is the sub-list for field type_name } func init() { file_slinky_marketmap_v1_market_proto_init() } @@ -5167,7 +2976,7 @@ func file_slinky_marketmap_v1_market_proto_init() { } if !protoimpl.UnsafeEnabled { file_slinky_marketmap_v1_market_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Ticker); i { + switch v := v.(*Market); i { case 0: return &v.state case 1: @@ -5179,7 +2988,7 @@ func file_slinky_marketmap_v1_market_proto_init() { } } file_slinky_marketmap_v1_market_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProviderConfig); i { + switch v := v.(*Ticker); i { case 0: return &v.state case 1: @@ -5191,7 +3000,7 @@ func file_slinky_marketmap_v1_market_proto_init() { } } file_slinky_marketmap_v1_market_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Path); i { + switch v := v.(*ProviderConfig); i { case 0: return &v.state case 1: @@ -5203,42 +3012,6 @@ func file_slinky_marketmap_v1_market_proto_init() { } } file_slinky_marketmap_v1_market_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Operation); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_marketmap_v1_market_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Paths); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_marketmap_v1_market_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Providers); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_marketmap_v1_market_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MarketMap); i { case 0: return &v.state @@ -5256,14 +3029,13 @@ func file_slinky_marketmap_v1_market_proto_init() { File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_slinky_marketmap_v1_market_proto_rawDesc, - NumEnums: 1, - NumMessages: 10, + NumEnums: 0, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, GoTypes: file_slinky_marketmap_v1_market_proto_goTypes, DependencyIndexes: file_slinky_marketmap_v1_market_proto_depIdxs, - EnumInfos: file_slinky_marketmap_v1_market_proto_enumTypes, MessageInfos: file_slinky_marketmap_v1_market_proto_msgTypes, }.Build() File_slinky_marketmap_v1_market_proto = out.File diff --git a/api/slinky/marketmap/v1/params.pulsar.go b/api/slinky/marketmap/v1/params.pulsar.go index bd12a81f4..021040d1b 100644 --- a/api/slinky/marketmap/v1/params.pulsar.go +++ b/api/slinky/marketmap/v1/params.pulsar.go @@ -12,17 +12,63 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_Params_1_list)(nil) + +type _Params_1_list struct { + list *[]string +} + +func (x *_Params_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_Params_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_Params_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_Params_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_Params_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message Params at list field MarketAuthorities as it is not of Message kind")) +} + +func (x *_Params_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_Params_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_Params_1_list) IsValid() bool { + return x.list != nil +} + var ( - md_Params protoreflect.MessageDescriptor - fd_Params_market_authority protoreflect.FieldDescriptor - fd_Params_version protoreflect.FieldDescriptor + md_Params protoreflect.MessageDescriptor + fd_Params_market_authorities protoreflect.FieldDescriptor + fd_Params_admin protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_params_proto_init() md_Params = File_slinky_marketmap_v1_params_proto.Messages().ByName("Params") - fd_Params_market_authority = md_Params.Fields().ByName("market_authority") - fd_Params_version = md_Params.Fields().ByName("version") + fd_Params_market_authorities = md_Params.Fields().ByName("market_authorities") + fd_Params_admin = md_Params.Fields().ByName("admin") } var _ protoreflect.Message = (*fastReflection_Params)(nil) @@ -90,15 +136,15 @@ func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { // While iterating, mutating operations may only be performed // on the current field descriptor. func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.MarketAuthority != "" { - value := protoreflect.ValueOfString(x.MarketAuthority) - if !f(fd_Params_market_authority, value) { + if len(x.MarketAuthorities) != 0 { + value := protoreflect.ValueOfList(&_Params_1_list{list: &x.MarketAuthorities}) + if !f(fd_Params_market_authorities, value) { return } } - if x.Version != uint64(0) { - value := protoreflect.ValueOfUint64(x.Version) - if !f(fd_Params_version, value) { + if x.Admin != "" { + value := protoreflect.ValueOfString(x.Admin) + if !f(fd_Params_admin, value) { return } } @@ -117,10 +163,10 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto // a repeated field is populated if it is non-empty. func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.Params.market_authority": - return x.MarketAuthority != "" - case "slinky.marketmap.v1.Params.version": - return x.Version != uint64(0) + case "slinky.marketmap.v1.Params.market_authorities": + return len(x.MarketAuthorities) != 0 + case "slinky.marketmap.v1.Params.admin": + return x.Admin != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Params")) @@ -137,10 +183,10 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // Clear is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.Params.market_authority": - x.MarketAuthority = "" - case "slinky.marketmap.v1.Params.version": - x.Version = uint64(0) + case "slinky.marketmap.v1.Params.market_authorities": + x.MarketAuthorities = nil + case "slinky.marketmap.v1.Params.admin": + x.Admin = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Params")) @@ -157,12 +203,15 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { // of the value; to obtain a mutable reference, use Mutable. func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.Params.market_authority": - value := x.MarketAuthority + case "slinky.marketmap.v1.Params.market_authorities": + if len(x.MarketAuthorities) == 0 { + return protoreflect.ValueOfList(&_Params_1_list{}) + } + listValue := &_Params_1_list{list: &x.MarketAuthorities} + return protoreflect.ValueOfList(listValue) + case "slinky.marketmap.v1.Params.admin": + value := x.Admin return protoreflect.ValueOfString(value) - case "slinky.marketmap.v1.Params.version": - value := x.Version - return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Params")) @@ -183,10 +232,12 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // Set is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.Params.market_authority": - x.MarketAuthority = value.Interface().(string) - case "slinky.marketmap.v1.Params.version": - x.Version = value.Uint() + case "slinky.marketmap.v1.Params.market_authorities": + lv := value.List() + clv := lv.(*_Params_1_list) + x.MarketAuthorities = *clv.list + case "slinky.marketmap.v1.Params.admin": + x.Admin = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Params")) @@ -207,10 +258,14 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto // Mutable is a mutating operation and unsafe for concurrent use. func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Params.market_authority": - panic(fmt.Errorf("field market_authority of message slinky.marketmap.v1.Params is not mutable")) - case "slinky.marketmap.v1.Params.version": - panic(fmt.Errorf("field version of message slinky.marketmap.v1.Params is not mutable")) + case "slinky.marketmap.v1.Params.market_authorities": + if x.MarketAuthorities == nil { + x.MarketAuthorities = []string{} + } + value := &_Params_1_list{list: &x.MarketAuthorities} + return protoreflect.ValueOfList(value) + case "slinky.marketmap.v1.Params.admin": + panic(fmt.Errorf("field admin of message slinky.marketmap.v1.Params is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Params")) @@ -224,10 +279,11 @@ func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protore // For lists, maps, and messages, this returns a new, empty, mutable value. func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.Params.market_authority": + case "slinky.marketmap.v1.Params.market_authorities": + list := []string{} + return protoreflect.ValueOfList(&_Params_1_list{list: &list}) + case "slinky.marketmap.v1.Params.admin": return protoreflect.ValueOfString("") - case "slinky.marketmap.v1.Params.version": - return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.Params")) @@ -297,13 +353,16 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.MarketAuthority) + if len(x.MarketAuthorities) > 0 { + for _, s := range x.MarketAuthorities { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + l = len(x.Admin) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Version != 0 { - n += 1 + runtime.Sov(uint64(x.Version)) - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -333,17 +392,21 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Version != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Version)) + if len(x.Admin) > 0 { + i -= len(x.Admin) + copy(dAtA[i:], x.Admin) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if len(x.MarketAuthority) > 0 { - i -= len(x.MarketAuthority) - copy(dAtA[i:], x.MarketAuthority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MarketAuthority))) - i-- - dAtA[i] = 0xa + if len(x.MarketAuthorities) > 0 { + for iNdEx := len(x.MarketAuthorities) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.MarketAuthorities[iNdEx]) + copy(dAtA[i:], x.MarketAuthorities[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MarketAuthorities[iNdEx]))) + i-- + dAtA[i] = 0xa + } } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -396,7 +459,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { switch fieldNum { case 1: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MarketAuthority", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MarketAuthorities", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -424,13 +487,13 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.MarketAuthority = string(dAtA[iNdEx:postIndex]) + x.MarketAuthorities = append(x.MarketAuthorities, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } - x.Version = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -440,11 +503,24 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - x.Version |= uint64(b&0x7F) << shift + 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.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -499,12 +575,12 @@ type Params struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // MarketAuthority is the authority account that is able to control updating - // the marketmap. - MarketAuthority string `protobuf:"bytes,1,opt,name=market_authority,json=marketAuthority,proto3" json:"market_authority,omitempty"` - // Version is the schema version for the MarketMap data structure and query - // response. - Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // MarketAuthorities is the list of authority accounts that are able to + // control updating the marketmap. + MarketAuthorities []string `protobuf:"bytes,1,rep,name=market_authorities,json=marketAuthorities,proto3" json:"market_authorities,omitempty"` + // Admin is an address that can remove addresses from the MarketAuthorities + // list. Only governance can add to the MarketAuthorities or change the Admin. + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` } func (x *Params) Reset() { @@ -527,18 +603,18 @@ func (*Params) Descriptor() ([]byte, []int) { return file_slinky_marketmap_v1_params_proto_rawDescGZIP(), []int{0} } -func (x *Params) GetMarketAuthority() string { +func (x *Params) GetMarketAuthorities() []string { if x != nil { - return x.MarketAuthority + return x.MarketAuthorities } - return "" + return nil } -func (x *Params) GetVersion() uint64 { +func (x *Params) GetAdmin() string { if x != nil { - return x.Version + return x.Admin } - return 0 + return "" } var File_slinky_marketmap_v1_params_proto protoreflect.FileDescriptor @@ -548,11 +624,11 @@ var file_slinky_marketmap_v1_params_proto_rawDesc = []byte{ 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x13, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x22, 0x4d, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x29, 0x0a, 0x10, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, 0x61, 0x75, 0x74, 0x68, - 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x18, 0x0a, 0x07, - 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, - 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x42, 0xc6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, + 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x11, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, + 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0xc6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, diff --git a/api/slinky/marketmap/v1/query.pulsar.go b/api/slinky/marketmap/v1/query.pulsar.go index af193c970..cd5b6e33e 100644 --- a/api/slinky/marketmap/v1/query.pulsar.go +++ b/api/slinky/marketmap/v1/query.pulsar.go @@ -5,6 +5,7 @@ import ( fmt "fmt" runtime "github.com/cosmos/cosmos-proto/runtime" _ "github.com/cosmos/gogoproto/gogoproto" + v1 "github.com/skip-mev/slinky/api/slinky/types/v1" _ "google.golang.org/genproto/googleapis/api/annotations" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoiface "google.golang.org/protobuf/runtime/protoiface" @@ -15,23 +16,23 @@ import ( ) var ( - md_GetMarketMapRequest protoreflect.MessageDescriptor + md_MarketMapRequest protoreflect.MessageDescriptor ) func init() { file_slinky_marketmap_v1_query_proto_init() - md_GetMarketMapRequest = File_slinky_marketmap_v1_query_proto.Messages().ByName("GetMarketMapRequest") + md_MarketMapRequest = File_slinky_marketmap_v1_query_proto.Messages().ByName("MarketMapRequest") } -var _ protoreflect.Message = (*fastReflection_GetMarketMapRequest)(nil) +var _ protoreflect.Message = (*fastReflection_MarketMapRequest)(nil) -type fastReflection_GetMarketMapRequest GetMarketMapRequest +type fastReflection_MarketMapRequest MarketMapRequest -func (x *GetMarketMapRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetMarketMapRequest)(x) +func (x *MarketMapRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_MarketMapRequest)(x) } -func (x *GetMarketMapRequest) slowProtoReflect() protoreflect.Message { +func (x *MarketMapRequest) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_query_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -43,43 +44,43 @@ func (x *GetMarketMapRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_GetMarketMapRequest_messageType fastReflection_GetMarketMapRequest_messageType -var _ protoreflect.MessageType = fastReflection_GetMarketMapRequest_messageType{} +var _fastReflection_MarketMapRequest_messageType fastReflection_MarketMapRequest_messageType +var _ protoreflect.MessageType = fastReflection_MarketMapRequest_messageType{} -type fastReflection_GetMarketMapRequest_messageType struct{} +type fastReflection_MarketMapRequest_messageType struct{} -func (x fastReflection_GetMarketMapRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetMarketMapRequest)(nil) +func (x fastReflection_MarketMapRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_MarketMapRequest)(nil) } -func (x fastReflection_GetMarketMapRequest_messageType) New() protoreflect.Message { - return new(fastReflection_GetMarketMapRequest) +func (x fastReflection_MarketMapRequest_messageType) New() protoreflect.Message { + return new(fastReflection_MarketMapRequest) } -func (x fastReflection_GetMarketMapRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetMarketMapRequest +func (x fastReflection_MarketMapRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MarketMapRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_GetMarketMapRequest) Descriptor() protoreflect.MessageDescriptor { - return md_GetMarketMapRequest +func (x *fastReflection_MarketMapRequest) Descriptor() protoreflect.MessageDescriptor { + return md_MarketMapRequest } // 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_GetMarketMapRequest) Type() protoreflect.MessageType { - return _fastReflection_GetMarketMapRequest_messageType +func (x *fastReflection_MarketMapRequest) Type() protoreflect.MessageType { + return _fastReflection_MarketMapRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetMarketMapRequest) New() protoreflect.Message { - return new(fastReflection_GetMarketMapRequest) +func (x *fastReflection_MarketMapRequest) New() protoreflect.Message { + return new(fastReflection_MarketMapRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_GetMarketMapRequest) Interface() protoreflect.ProtoMessage { - return (*GetMarketMapRequest)(x) +func (x *fastReflection_MarketMapRequest) Interface() protoreflect.ProtoMessage { + return (*MarketMapRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -87,7 +88,7 @@ func (x *fastReflection_GetMarketMapRequest) Interface() protoreflect.ProtoMessa // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_GetMarketMapRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MarketMapRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -101,13 +102,13 @@ func (x *fastReflection_GetMarketMapRequest) Range(f func(protoreflect.FieldDesc // 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_GetMarketMapRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MarketMapRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapRequest does not contain field %s", fd.FullName())) } } @@ -117,13 +118,13 @@ func (x *fastReflection_GetMarketMapRequest) Has(fd protoreflect.FieldDescriptor // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MarketMapRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapRequest does not contain field %s", fd.FullName())) } } @@ -133,13 +134,13 @@ func (x *fastReflection_GetMarketMapRequest) Clear(fd protoreflect.FieldDescript // 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_GetMarketMapRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketMapRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapRequest does not contain field %s", descriptor.FullName())) } } @@ -153,13 +154,13 @@ func (x *fastReflection_GetMarketMapRequest) Get(descriptor protoreflect.FieldDe // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MarketMapRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapRequest does not contain field %s", fd.FullName())) } } @@ -173,36 +174,36 @@ func (x *fastReflection_GetMarketMapRequest) Set(fd protoreflect.FieldDescriptor // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketMapRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapRequest 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_GetMarketMapRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketMapRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapRequest 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_GetMarketMapRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MarketMapRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.GetMarketMapRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MarketMapRequest", d.FullName())) } panic("unreachable") } @@ -210,7 +211,7 @@ func (x *fastReflection_GetMarketMapRequest) WhichOneof(d protoreflect.OneofDesc // 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_GetMarketMapRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MarketMapRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -221,7 +222,7 @@ func (x *fastReflection_GetMarketMapRequest) GetUnknown() protoreflect.RawFields // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MarketMapRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -233,7 +234,7 @@ func (x *fastReflection_GetMarketMapRequest) SetUnknown(fields protoreflect.RawF // 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_GetMarketMapRequest) IsValid() bool { +func (x *fastReflection_MarketMapRequest) IsValid() bool { return x != nil } @@ -243,9 +244,9 @@ func (x *fastReflection_GetMarketMapRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_GetMarketMapRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MarketMapRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetMarketMapRequest) + x := input.Message.Interface().(*MarketMapRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -267,7 +268,7 @@ func (x *fastReflection_GetMarketMapRequest) ProtoMethods() *protoiface.Methods } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetMarketMapRequest) + x := input.Message.Interface().(*MarketMapRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -297,7 +298,7 @@ func (x *fastReflection_GetMarketMapRequest) ProtoMethods() *protoiface.Methods }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetMarketMapRequest) + x := input.Message.Interface().(*MarketMapRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -329,10 +330,10 @@ func (x *fastReflection_GetMarketMapRequest) ProtoMethods() *protoiface.Methods fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetMarketMapRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMapRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetMarketMapRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMapRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -371,31 +372,29 @@ func (x *fastReflection_GetMarketMapRequest) ProtoMethods() *protoiface.Methods } var ( - md_GetMarketMapResponse protoreflect.MessageDescriptor - fd_GetMarketMapResponse_market_map protoreflect.FieldDescriptor - fd_GetMarketMapResponse_last_updated protoreflect.FieldDescriptor - fd_GetMarketMapResponse_version protoreflect.FieldDescriptor - fd_GetMarketMapResponse_chain_id protoreflect.FieldDescriptor + md_MarketMapResponse protoreflect.MessageDescriptor + fd_MarketMapResponse_market_map protoreflect.FieldDescriptor + fd_MarketMapResponse_last_updated protoreflect.FieldDescriptor + fd_MarketMapResponse_chain_id protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_query_proto_init() - md_GetMarketMapResponse = File_slinky_marketmap_v1_query_proto.Messages().ByName("GetMarketMapResponse") - fd_GetMarketMapResponse_market_map = md_GetMarketMapResponse.Fields().ByName("market_map") - fd_GetMarketMapResponse_last_updated = md_GetMarketMapResponse.Fields().ByName("last_updated") - fd_GetMarketMapResponse_version = md_GetMarketMapResponse.Fields().ByName("version") - fd_GetMarketMapResponse_chain_id = md_GetMarketMapResponse.Fields().ByName("chain_id") + md_MarketMapResponse = File_slinky_marketmap_v1_query_proto.Messages().ByName("MarketMapResponse") + fd_MarketMapResponse_market_map = md_MarketMapResponse.Fields().ByName("market_map") + fd_MarketMapResponse_last_updated = md_MarketMapResponse.Fields().ByName("last_updated") + fd_MarketMapResponse_chain_id = md_MarketMapResponse.Fields().ByName("chain_id") } -var _ protoreflect.Message = (*fastReflection_GetMarketMapResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MarketMapResponse)(nil) -type fastReflection_GetMarketMapResponse GetMarketMapResponse +type fastReflection_MarketMapResponse MarketMapResponse -func (x *GetMarketMapResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetMarketMapResponse)(x) +func (x *MarketMapResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MarketMapResponse)(x) } -func (x *GetMarketMapResponse) slowProtoReflect() protoreflect.Message { +func (x *MarketMapResponse) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_query_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -407,43 +406,43 @@ func (x *GetMarketMapResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_GetMarketMapResponse_messageType fastReflection_GetMarketMapResponse_messageType -var _ protoreflect.MessageType = fastReflection_GetMarketMapResponse_messageType{} +var _fastReflection_MarketMapResponse_messageType fastReflection_MarketMapResponse_messageType +var _ protoreflect.MessageType = fastReflection_MarketMapResponse_messageType{} -type fastReflection_GetMarketMapResponse_messageType struct{} +type fastReflection_MarketMapResponse_messageType struct{} -func (x fastReflection_GetMarketMapResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetMarketMapResponse)(nil) +func (x fastReflection_MarketMapResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MarketMapResponse)(nil) } -func (x fastReflection_GetMarketMapResponse_messageType) New() protoreflect.Message { - return new(fastReflection_GetMarketMapResponse) +func (x fastReflection_MarketMapResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MarketMapResponse) } -func (x fastReflection_GetMarketMapResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetMarketMapResponse +func (x fastReflection_MarketMapResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MarketMapResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_GetMarketMapResponse) Descriptor() protoreflect.MessageDescriptor { - return md_GetMarketMapResponse +func (x *fastReflection_MarketMapResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MarketMapResponse } // 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_GetMarketMapResponse) Type() protoreflect.MessageType { - return _fastReflection_GetMarketMapResponse_messageType +func (x *fastReflection_MarketMapResponse) Type() protoreflect.MessageType { + return _fastReflection_MarketMapResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetMarketMapResponse) New() protoreflect.Message { - return new(fastReflection_GetMarketMapResponse) +func (x *fastReflection_MarketMapResponse) New() protoreflect.Message { + return new(fastReflection_MarketMapResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_GetMarketMapResponse) Interface() protoreflect.ProtoMessage { - return (*GetMarketMapResponse)(x) +func (x *fastReflection_MarketMapResponse) Interface() protoreflect.ProtoMessage { + return (*MarketMapResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -451,28 +450,988 @@ func (x *fastReflection_GetMarketMapResponse) Interface() protoreflect.ProtoMess // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_GetMarketMapResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MarketMapResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.MarketMap != nil { value := protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) - if !f(fd_GetMarketMapResponse_market_map, value) { + if !f(fd_MarketMapResponse_market_map, value) { return } } if x.LastUpdated != uint64(0) { value := protoreflect.ValueOfUint64(x.LastUpdated) - if !f(fd_GetMarketMapResponse_last_updated, value) { + if !f(fd_MarketMapResponse_last_updated, value) { return } } - if x.Version != uint64(0) { - value := protoreflect.ValueOfUint64(x.Version) - if !f(fd_GetMarketMapResponse_version, value) { + if x.ChainId != "" { + value := protoreflect.ValueOfString(x.ChainId) + if !f(fd_MarketMapResponse_chain_id, value) { return } } - if x.ChainId != "" { - value := protoreflect.ValueOfString(x.ChainId) - if !f(fd_GetMarketMapResponse_chain_id, value) { +} + +// 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_MarketMapResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketMapResponse.market_map": + return x.MarketMap != nil + case "slinky.marketmap.v1.MarketMapResponse.last_updated": + return x.LastUpdated != uint64(0) + case "slinky.marketmap.v1.MarketMapResponse.chain_id": + return x.ChainId != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapResponse 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_MarketMapResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketMapResponse.market_map": + x.MarketMap = nil + case "slinky.marketmap.v1.MarketMapResponse.last_updated": + x.LastUpdated = uint64(0) + case "slinky.marketmap.v1.MarketMapResponse.chain_id": + x.ChainId = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapResponse 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_MarketMapResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "slinky.marketmap.v1.MarketMapResponse.market_map": + value := x.MarketMap + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "slinky.marketmap.v1.MarketMapResponse.last_updated": + value := x.LastUpdated + return protoreflect.ValueOfUint64(value) + case "slinky.marketmap.v1.MarketMapResponse.chain_id": + value := x.ChainId + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapResponse 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_MarketMapResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketMapResponse.market_map": + x.MarketMap = value.Message().Interface().(*MarketMap) + case "slinky.marketmap.v1.MarketMapResponse.last_updated": + x.LastUpdated = value.Uint() + case "slinky.marketmap.v1.MarketMapResponse.chain_id": + x.ChainId = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapResponse 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_MarketMapResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketMapResponse.market_map": + if x.MarketMap == nil { + x.MarketMap = new(MarketMap) + } + return protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) + case "slinky.marketmap.v1.MarketMapResponse.last_updated": + panic(fmt.Errorf("field last_updated of message slinky.marketmap.v1.MarketMapResponse is not mutable")) + case "slinky.marketmap.v1.MarketMapResponse.chain_id": + panic(fmt.Errorf("field chain_id of message slinky.marketmap.v1.MarketMapResponse is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapResponse 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_MarketMapResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketMapResponse.market_map": + m := new(MarketMap) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "slinky.marketmap.v1.MarketMapResponse.last_updated": + return protoreflect.ValueOfUint64(uint64(0)) + case "slinky.marketmap.v1.MarketMapResponse.chain_id": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketMapResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketMapResponse 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_MarketMapResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MarketMapResponse", 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_MarketMapResponse) 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_MarketMapResponse) 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_MarketMapResponse) 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_MarketMapResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MarketMapResponse) + 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.MarketMap != nil { + l = options.Size(x.MarketMap) + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.LastUpdated != 0 { + n += 1 + runtime.Sov(uint64(x.LastUpdated)) + } + l = len(x.ChainId) + 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().(*MarketMapResponse) + 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.ChainId) > 0 { + i -= len(x.ChainId) + copy(dAtA[i:], x.ChainId) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ChainId))) + i-- + dAtA[i] = 0x1a + } + if x.LastUpdated != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.LastUpdated)) + i-- + dAtA[i] = 0x10 + } + if x.MarketMap != nil { + encoded, err := options.Marshal(x.MarketMap) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MarketMapResponse) + 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: MarketMapResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMapResponse: 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 MarketMap", 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.MarketMap == nil { + x.MarketMap = &MarketMap{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MarketMap); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) + } + x.LastUpdated = 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.LastUpdated |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChainId", 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.ChainId = 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_MarketRequest protoreflect.MessageDescriptor + fd_MarketRequest_currency_pair protoreflect.FieldDescriptor +) + +func init() { + file_slinky_marketmap_v1_query_proto_init() + md_MarketRequest = File_slinky_marketmap_v1_query_proto.Messages().ByName("MarketRequest") + fd_MarketRequest_currency_pair = md_MarketRequest.Fields().ByName("currency_pair") +} + +var _ protoreflect.Message = (*fastReflection_MarketRequest)(nil) + +type fastReflection_MarketRequest MarketRequest + +func (x *MarketRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_MarketRequest)(x) +} + +func (x *MarketRequest) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_query_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_MarketRequest_messageType fastReflection_MarketRequest_messageType +var _ protoreflect.MessageType = fastReflection_MarketRequest_messageType{} + +type fastReflection_MarketRequest_messageType struct{} + +func (x fastReflection_MarketRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_MarketRequest)(nil) +} +func (x fastReflection_MarketRequest_messageType) New() protoreflect.Message { + return new(fastReflection_MarketRequest) +} +func (x fastReflection_MarketRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MarketRequest +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MarketRequest) Descriptor() protoreflect.MessageDescriptor { + return md_MarketRequest +} + +// 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_MarketRequest) Type() protoreflect.MessageType { + return _fastReflection_MarketRequest_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MarketRequest) New() protoreflect.Message { + return new(fastReflection_MarketRequest) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MarketRequest) Interface() protoreflect.ProtoMessage { + return (*MarketRequest)(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_MarketRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.CurrencyPair != nil { + value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) + if !f(fd_MarketRequest_currency_pair, 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_MarketRequest) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketRequest.currency_pair": + return x.CurrencyPair != nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketRequest")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketRequest 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_MarketRequest) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketRequest.currency_pair": + x.CurrencyPair = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketRequest")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketRequest 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_MarketRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "slinky.marketmap.v1.MarketRequest.currency_pair": + value := x.CurrencyPair + return protoreflect.ValueOfMessage(value.ProtoReflect()) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketRequest")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketRequest 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_MarketRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketRequest.currency_pair": + x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketRequest")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketRequest 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_MarketRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketRequest.currency_pair": + if x.CurrencyPair == nil { + x.CurrencyPair = new(v1.CurrencyPair) + } + return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketRequest")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketRequest 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_MarketRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "slinky.marketmap.v1.MarketRequest.currency_pair": + m := new(v1.CurrencyPair) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketRequest")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MarketRequest 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_MarketRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MarketRequest", 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_MarketRequest) 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_MarketRequest) 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_MarketRequest) 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_MarketRequest) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MarketRequest) + 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.CurrencyPair != nil { + l = options.Size(x.CurrencyPair) + 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().(*MarketRequest) + 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.CurrencyPair != nil { + encoded, err := options.Marshal(x.CurrencyPair) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x1a + } + if 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().(*MarketRequest) + 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: MarketRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", 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.CurrencyPair == nil { + x.CurrencyPair = &v1.CurrencyPair{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MarketResponse protoreflect.MessageDescriptor + fd_MarketResponse_market protoreflect.FieldDescriptor +) + +func init() { + file_slinky_marketmap_v1_query_proto_init() + md_MarketResponse = File_slinky_marketmap_v1_query_proto.Messages().ByName("MarketResponse") + fd_MarketResponse_market = md_MarketResponse.Fields().ByName("market") +} + +var _ protoreflect.Message = (*fastReflection_MarketResponse)(nil) + +type fastReflection_MarketResponse MarketResponse + +func (x *MarketResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MarketResponse)(x) +} + +func (x *MarketResponse) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_query_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_MarketResponse_messageType fastReflection_MarketResponse_messageType +var _ protoreflect.MessageType = fastReflection_MarketResponse_messageType{} + +type fastReflection_MarketResponse_messageType struct{} + +func (x fastReflection_MarketResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MarketResponse)(nil) +} +func (x fastReflection_MarketResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MarketResponse) +} +func (x fastReflection_MarketResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MarketResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MarketResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MarketResponse +} + +// 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_MarketResponse) Type() protoreflect.MessageType { + return _fastReflection_MarketResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MarketResponse) New() protoreflect.Message { + return new(fastReflection_MarketResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MarketResponse) Interface() protoreflect.ProtoMessage { + return (*MarketResponse)(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_MarketResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Market != nil { + value := protoreflect.ValueOfMessage(x.Market.ProtoReflect()) + if !f(fd_MarketResponse_market, value) { return } } @@ -489,21 +1448,15 @@ func (x *fastReflection_GetMarketMapResponse) Range(f func(protoreflect.FieldDes // 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_GetMarketMapResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MarketResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.GetMarketMapResponse.market_map": - return x.MarketMap != nil - case "slinky.marketmap.v1.GetMarketMapResponse.last_updated": - return x.LastUpdated != uint64(0) - case "slinky.marketmap.v1.GetMarketMapResponse.version": - return x.Version != uint64(0) - case "slinky.marketmap.v1.GetMarketMapResponse.chain_id": - return x.ChainId != "" + case "slinky.marketmap.v1.MarketResponse.market": + return x.Market != nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketResponse does not contain field %s", fd.FullName())) } } @@ -513,21 +1466,15 @@ func (x *fastReflection_GetMarketMapResponse) Has(fd protoreflect.FieldDescripto // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MarketResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.GetMarketMapResponse.market_map": - x.MarketMap = nil - case "slinky.marketmap.v1.GetMarketMapResponse.last_updated": - x.LastUpdated = uint64(0) - case "slinky.marketmap.v1.GetMarketMapResponse.version": - x.Version = uint64(0) - case "slinky.marketmap.v1.GetMarketMapResponse.chain_id": - x.ChainId = "" + case "slinky.marketmap.v1.MarketResponse.market": + x.Market = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketResponse does not contain field %s", fd.FullName())) } } @@ -537,25 +1484,16 @@ func (x *fastReflection_GetMarketMapResponse) Clear(fd protoreflect.FieldDescrip // 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_GetMarketMapResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.GetMarketMapResponse.market_map": - value := x.MarketMap + case "slinky.marketmap.v1.MarketResponse.market": + value := x.Market return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.marketmap.v1.GetMarketMapResponse.last_updated": - value := x.LastUpdated - return protoreflect.ValueOfUint64(value) - case "slinky.marketmap.v1.GetMarketMapResponse.version": - value := x.Version - return protoreflect.ValueOfUint64(value) - case "slinky.marketmap.v1.GetMarketMapResponse.chain_id": - value := x.ChainId - return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketResponse does not contain field %s", descriptor.FullName())) } } @@ -569,21 +1507,15 @@ func (x *fastReflection_GetMarketMapResponse) Get(descriptor protoreflect.FieldD // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MarketResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.GetMarketMapResponse.market_map": - x.MarketMap = value.Message().Interface().(*MarketMap) - case "slinky.marketmap.v1.GetMarketMapResponse.last_updated": - x.LastUpdated = value.Uint() - case "slinky.marketmap.v1.GetMarketMapResponse.version": - x.Version = value.Uint() - case "slinky.marketmap.v1.GetMarketMapResponse.chain_id": - x.ChainId = value.Interface().(string) + case "slinky.marketmap.v1.MarketResponse.market": + x.Market = value.Message().Interface().(*Market) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketResponse does not contain field %s", fd.FullName())) } } @@ -597,56 +1529,44 @@ func (x *fastReflection_GetMarketMapResponse) Set(fd protoreflect.FieldDescripto // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.GetMarketMapResponse.market_map": - if x.MarketMap == nil { - x.MarketMap = new(MarketMap) + case "slinky.marketmap.v1.MarketResponse.market": + if x.Market == nil { + x.Market = new(Market) } - return protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) - case "slinky.marketmap.v1.GetMarketMapResponse.last_updated": - panic(fmt.Errorf("field last_updated of message slinky.marketmap.v1.GetMarketMapResponse is not mutable")) - case "slinky.marketmap.v1.GetMarketMapResponse.version": - panic(fmt.Errorf("field version of message slinky.marketmap.v1.GetMarketMapResponse is not mutable")) - case "slinky.marketmap.v1.GetMarketMapResponse.chain_id": - panic(fmt.Errorf("field chain_id of message slinky.marketmap.v1.GetMarketMapResponse is not mutable")) + return protoreflect.ValueOfMessage(x.Market.ProtoReflect()) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketResponse 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_GetMarketMapResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MarketResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.GetMarketMapResponse.market_map": - m := new(MarketMap) + case "slinky.marketmap.v1.MarketResponse.market": + m := new(Market) return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.marketmap.v1.GetMarketMapResponse.last_updated": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.marketmap.v1.GetMarketMapResponse.version": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.marketmap.v1.GetMarketMapResponse.chain_id": - return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MarketResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MarketResponse 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_GetMarketMapResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MarketResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.GetMarketMapResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MarketResponse", d.FullName())) } panic("unreachable") } @@ -654,7 +1574,7 @@ func (x *fastReflection_GetMarketMapResponse) WhichOneof(d protoreflect.OneofDes // 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_GetMarketMapResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MarketResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -665,7 +1585,7 @@ func (x *fastReflection_GetMarketMapResponse) GetUnknown() protoreflect.RawField // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetMarketMapResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MarketResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -677,7 +1597,7 @@ func (x *fastReflection_GetMarketMapResponse) SetUnknown(fields protoreflect.Raw // 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_GetMarketMapResponse) IsValid() bool { +func (x *fastReflection_MarketResponse) IsValid() bool { return x != nil } @@ -687,9 +1607,9 @@ func (x *fastReflection_GetMarketMapResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MarketResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetMarketMapResponse) + x := input.Message.Interface().(*MarketResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -701,18 +1621,8 @@ func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods var n int var l int _ = l - if x.MarketMap != nil { - l = options.Size(x.MarketMap) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.LastUpdated != 0 { - n += 1 + runtime.Sov(uint64(x.LastUpdated)) - } - if x.Version != 0 { - n += 1 + runtime.Sov(uint64(x.Version)) - } - l = len(x.ChainId) - if l > 0 { + if x.Market != nil { + l = options.Size(x.Market) n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { @@ -725,7 +1635,7 @@ func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetMarketMapResponse) + x := input.Message.Interface().(*MarketResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -744,25 +1654,8 @@ func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.ChainId) > 0 { - i -= len(x.ChainId) - copy(dAtA[i:], x.ChainId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ChainId))) - i-- - dAtA[i] = 0x22 - } - if x.Version != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Version)) - i-- - dAtA[i] = 0x18 - } - if x.LastUpdated != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.LastUpdated)) - i-- - dAtA[i] = 0x10 - } - if x.MarketMap != nil { - encoded, err := options.Marshal(x.MarketMap) + if x.Market != nil { + encoded, err := options.Marshal(x.Market) if err != nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -786,7 +1679,7 @@ func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetMarketMapResponse) + x := input.Message.Interface().(*MarketResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -818,15 +1711,15 @@ func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetMarketMapResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetMarketMapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketResponse: 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 MarketMap", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Market", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -853,83 +1746,13 @@ func (x *fastReflection_GetMarketMapResponse) ProtoMethods() *protoiface.Methods if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.MarketMap == nil { - x.MarketMap = &MarketMap{} + if x.Market == nil { + x.Market = &Market{} } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MarketMap); err != nil { + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Market); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - x.LastUpdated = 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.LastUpdated |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - x.Version = 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.Version |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChainId", 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.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -983,7 +1806,7 @@ func (x *ParamsRequest) ProtoReflect() protoreflect.Message { } func (x *ParamsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[2] + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[4] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1341,7 +2164,7 @@ func (x *ParamsResponse) ProtoReflect() protoreflect.Message { } func (x *ParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[3] + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1757,24 +2580,24 @@ func (x *fastReflection_ParamsResponse) ProtoMethods() *protoiface.Methods { } var ( - md_GetLastUpdatedRequest protoreflect.MessageDescriptor + md_LastUpdatedRequest protoreflect.MessageDescriptor ) func init() { file_slinky_marketmap_v1_query_proto_init() - md_GetLastUpdatedRequest = File_slinky_marketmap_v1_query_proto.Messages().ByName("GetLastUpdatedRequest") + md_LastUpdatedRequest = File_slinky_marketmap_v1_query_proto.Messages().ByName("LastUpdatedRequest") } -var _ protoreflect.Message = (*fastReflection_GetLastUpdatedRequest)(nil) +var _ protoreflect.Message = (*fastReflection_LastUpdatedRequest)(nil) -type fastReflection_GetLastUpdatedRequest GetLastUpdatedRequest +type fastReflection_LastUpdatedRequest LastUpdatedRequest -func (x *GetLastUpdatedRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetLastUpdatedRequest)(x) +func (x *LastUpdatedRequest) ProtoReflect() protoreflect.Message { + return (*fastReflection_LastUpdatedRequest)(x) } -func (x *GetLastUpdatedRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[4] +func (x *LastUpdatedRequest) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1785,43 +2608,43 @@ func (x *GetLastUpdatedRequest) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_GetLastUpdatedRequest_messageType fastReflection_GetLastUpdatedRequest_messageType -var _ protoreflect.MessageType = fastReflection_GetLastUpdatedRequest_messageType{} +var _fastReflection_LastUpdatedRequest_messageType fastReflection_LastUpdatedRequest_messageType +var _ protoreflect.MessageType = fastReflection_LastUpdatedRequest_messageType{} -type fastReflection_GetLastUpdatedRequest_messageType struct{} +type fastReflection_LastUpdatedRequest_messageType struct{} -func (x fastReflection_GetLastUpdatedRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetLastUpdatedRequest)(nil) +func (x fastReflection_LastUpdatedRequest_messageType) Zero() protoreflect.Message { + return (*fastReflection_LastUpdatedRequest)(nil) } -func (x fastReflection_GetLastUpdatedRequest_messageType) New() protoreflect.Message { - return new(fastReflection_GetLastUpdatedRequest) +func (x fastReflection_LastUpdatedRequest_messageType) New() protoreflect.Message { + return new(fastReflection_LastUpdatedRequest) } -func (x fastReflection_GetLastUpdatedRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetLastUpdatedRequest +func (x fastReflection_LastUpdatedRequest_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_LastUpdatedRequest } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_GetLastUpdatedRequest) Descriptor() protoreflect.MessageDescriptor { - return md_GetLastUpdatedRequest +func (x *fastReflection_LastUpdatedRequest) Descriptor() protoreflect.MessageDescriptor { + return md_LastUpdatedRequest } // 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_GetLastUpdatedRequest) Type() protoreflect.MessageType { - return _fastReflection_GetLastUpdatedRequest_messageType +func (x *fastReflection_LastUpdatedRequest) Type() protoreflect.MessageType { + return _fastReflection_LastUpdatedRequest_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetLastUpdatedRequest) New() protoreflect.Message { - return new(fastReflection_GetLastUpdatedRequest) +func (x *fastReflection_LastUpdatedRequest) New() protoreflect.Message { + return new(fastReflection_LastUpdatedRequest) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_GetLastUpdatedRequest) Interface() protoreflect.ProtoMessage { - return (*GetLastUpdatedRequest)(x) +func (x *fastReflection_LastUpdatedRequest) Interface() protoreflect.ProtoMessage { + return (*LastUpdatedRequest)(x) } // Range iterates over every populated field in an undefined order, @@ -1829,7 +2652,7 @@ func (x *fastReflection_GetLastUpdatedRequest) Interface() protoreflect.ProtoMes // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_GetLastUpdatedRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_LastUpdatedRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -1843,13 +2666,13 @@ func (x *fastReflection_GetLastUpdatedRequest) Range(f func(protoreflect.FieldDe // 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_GetLastUpdatedRequest) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_LastUpdatedRequest) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedRequest does not contain field %s", fd.FullName())) } } @@ -1859,13 +2682,13 @@ func (x *fastReflection_GetLastUpdatedRequest) Has(fd protoreflect.FieldDescript // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedRequest) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_LastUpdatedRequest) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedRequest does not contain field %s", fd.FullName())) } } @@ -1875,13 +2698,13 @@ func (x *fastReflection_GetLastUpdatedRequest) Clear(fd protoreflect.FieldDescri // 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_GetLastUpdatedRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LastUpdatedRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedRequest does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedRequest does not contain field %s", descriptor.FullName())) } } @@ -1895,13 +2718,13 @@ func (x *fastReflection_GetLastUpdatedRequest) Get(descriptor protoreflect.Field // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_LastUpdatedRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedRequest does not contain field %s", fd.FullName())) } } @@ -1915,36 +2738,36 @@ func (x *fastReflection_GetLastUpdatedRequest) Set(fd protoreflect.FieldDescript // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LastUpdatedRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedRequest 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_GetLastUpdatedRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LastUpdatedRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedRequest")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedRequest")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedRequest does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedRequest 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_GetLastUpdatedRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_LastUpdatedRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.GetLastUpdatedRequest", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.LastUpdatedRequest", d.FullName())) } panic("unreachable") } @@ -1952,7 +2775,7 @@ func (x *fastReflection_GetLastUpdatedRequest) WhichOneof(d protoreflect.OneofDe // 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_GetLastUpdatedRequest) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_LastUpdatedRequest) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1963,7 +2786,7 @@ func (x *fastReflection_GetLastUpdatedRequest) GetUnknown() protoreflect.RawFiel // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedRequest) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_LastUpdatedRequest) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1975,7 +2798,7 @@ func (x *fastReflection_GetLastUpdatedRequest) SetUnknown(fields protoreflect.Ra // 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_GetLastUpdatedRequest) IsValid() bool { +func (x *fastReflection_LastUpdatedRequest) IsValid() bool { return x != nil } @@ -1985,9 +2808,9 @@ func (x *fastReflection_GetLastUpdatedRequest) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_GetLastUpdatedRequest) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_LastUpdatedRequest) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetLastUpdatedRequest) + x := input.Message.Interface().(*LastUpdatedRequest) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2009,7 +2832,7 @@ func (x *fastReflection_GetLastUpdatedRequest) ProtoMethods() *protoiface.Method } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetLastUpdatedRequest) + x := input.Message.Interface().(*LastUpdatedRequest) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2039,7 +2862,7 @@ func (x *fastReflection_GetLastUpdatedRequest) ProtoMethods() *protoiface.Method }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetLastUpdatedRequest) + x := input.Message.Interface().(*LastUpdatedRequest) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2071,10 +2894,10 @@ func (x *fastReflection_GetLastUpdatedRequest) ProtoMethods() *protoiface.Method fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetLastUpdatedRequest: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LastUpdatedRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetLastUpdatedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LastUpdatedRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2113,26 +2936,26 @@ func (x *fastReflection_GetLastUpdatedRequest) ProtoMethods() *protoiface.Method } var ( - md_GetLastUpdatedResponse protoreflect.MessageDescriptor - fd_GetLastUpdatedResponse_last_updated protoreflect.FieldDescriptor + md_LastUpdatedResponse protoreflect.MessageDescriptor + fd_LastUpdatedResponse_last_updated protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_query_proto_init() - md_GetLastUpdatedResponse = File_slinky_marketmap_v1_query_proto.Messages().ByName("GetLastUpdatedResponse") - fd_GetLastUpdatedResponse_last_updated = md_GetLastUpdatedResponse.Fields().ByName("last_updated") + md_LastUpdatedResponse = File_slinky_marketmap_v1_query_proto.Messages().ByName("LastUpdatedResponse") + fd_LastUpdatedResponse_last_updated = md_LastUpdatedResponse.Fields().ByName("last_updated") } -var _ protoreflect.Message = (*fastReflection_GetLastUpdatedResponse)(nil) +var _ protoreflect.Message = (*fastReflection_LastUpdatedResponse)(nil) -type fastReflection_GetLastUpdatedResponse GetLastUpdatedResponse +type fastReflection_LastUpdatedResponse LastUpdatedResponse -func (x *GetLastUpdatedResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_GetLastUpdatedResponse)(x) +func (x *LastUpdatedResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_LastUpdatedResponse)(x) } -func (x *GetLastUpdatedResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[5] +func (x *LastUpdatedResponse) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2143,43 +2966,43 @@ func (x *GetLastUpdatedResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_GetLastUpdatedResponse_messageType fastReflection_GetLastUpdatedResponse_messageType -var _ protoreflect.MessageType = fastReflection_GetLastUpdatedResponse_messageType{} +var _fastReflection_LastUpdatedResponse_messageType fastReflection_LastUpdatedResponse_messageType +var _ protoreflect.MessageType = fastReflection_LastUpdatedResponse_messageType{} -type fastReflection_GetLastUpdatedResponse_messageType struct{} +type fastReflection_LastUpdatedResponse_messageType struct{} -func (x fastReflection_GetLastUpdatedResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_GetLastUpdatedResponse)(nil) +func (x fastReflection_LastUpdatedResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_LastUpdatedResponse)(nil) } -func (x fastReflection_GetLastUpdatedResponse_messageType) New() protoreflect.Message { - return new(fastReflection_GetLastUpdatedResponse) +func (x fastReflection_LastUpdatedResponse_messageType) New() protoreflect.Message { + return new(fastReflection_LastUpdatedResponse) } -func (x fastReflection_GetLastUpdatedResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GetLastUpdatedResponse +func (x fastReflection_LastUpdatedResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_LastUpdatedResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_GetLastUpdatedResponse) Descriptor() protoreflect.MessageDescriptor { - return md_GetLastUpdatedResponse +func (x *fastReflection_LastUpdatedResponse) Descriptor() protoreflect.MessageDescriptor { + return md_LastUpdatedResponse } // 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_GetLastUpdatedResponse) Type() protoreflect.MessageType { - return _fastReflection_GetLastUpdatedResponse_messageType +func (x *fastReflection_LastUpdatedResponse) Type() protoreflect.MessageType { + return _fastReflection_LastUpdatedResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_GetLastUpdatedResponse) New() protoreflect.Message { - return new(fastReflection_GetLastUpdatedResponse) +func (x *fastReflection_LastUpdatedResponse) New() protoreflect.Message { + return new(fastReflection_LastUpdatedResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_GetLastUpdatedResponse) Interface() protoreflect.ProtoMessage { - return (*GetLastUpdatedResponse)(x) +func (x *fastReflection_LastUpdatedResponse) Interface() protoreflect.ProtoMessage { + return (*LastUpdatedResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2187,10 +3010,10 @@ func (x *fastReflection_GetLastUpdatedResponse) Interface() protoreflect.ProtoMe // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_GetLastUpdatedResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_LastUpdatedResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.LastUpdated != uint64(0) { value := protoreflect.ValueOfUint64(x.LastUpdated) - if !f(fd_GetLastUpdatedResponse_last_updated, value) { + if !f(fd_LastUpdatedResponse_last_updated, value) { return } } @@ -2207,15 +3030,15 @@ func (x *fastReflection_GetLastUpdatedResponse) Range(f func(protoreflect.FieldD // 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_GetLastUpdatedResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_LastUpdatedResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.GetLastUpdatedResponse.last_updated": + case "slinky.marketmap.v1.LastUpdatedResponse.last_updated": return x.LastUpdated != uint64(0) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedResponse does not contain field %s", fd.FullName())) } } @@ -2225,15 +3048,15 @@ func (x *fastReflection_GetLastUpdatedResponse) Has(fd protoreflect.FieldDescrip // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_LastUpdatedResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.GetLastUpdatedResponse.last_updated": + case "slinky.marketmap.v1.LastUpdatedResponse.last_updated": x.LastUpdated = uint64(0) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedResponse does not contain field %s", fd.FullName())) } } @@ -2243,16 +3066,16 @@ func (x *fastReflection_GetLastUpdatedResponse) Clear(fd protoreflect.FieldDescr // 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_GetLastUpdatedResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LastUpdatedResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.GetLastUpdatedResponse.last_updated": + case "slinky.marketmap.v1.LastUpdatedResponse.last_updated": value := x.LastUpdated return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedResponse does not contain field %s", descriptor.FullName())) } } @@ -2266,15 +3089,15 @@ func (x *fastReflection_GetLastUpdatedResponse) Get(descriptor protoreflect.Fiel // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_LastUpdatedResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.GetLastUpdatedResponse.last_updated": + case "slinky.marketmap.v1.LastUpdatedResponse.last_updated": x.LastUpdated = value.Uint() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedResponse does not contain field %s", fd.FullName())) } } @@ -2288,40 +3111,40 @@ func (x *fastReflection_GetLastUpdatedResponse) Set(fd protoreflect.FieldDescrip // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LastUpdatedResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.GetLastUpdatedResponse.last_updated": - panic(fmt.Errorf("field last_updated of message slinky.marketmap.v1.GetLastUpdatedResponse is not mutable")) + case "slinky.marketmap.v1.LastUpdatedResponse.last_updated": + panic(fmt.Errorf("field last_updated of message slinky.marketmap.v1.LastUpdatedResponse is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedResponse 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_GetLastUpdatedResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LastUpdatedResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.GetLastUpdatedResponse.last_updated": + case "slinky.marketmap.v1.LastUpdatedResponse.last_updated": return protoreflect.ValueOfUint64(uint64(0)) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.GetLastUpdatedResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.LastUpdatedResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.GetLastUpdatedResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.LastUpdatedResponse 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_GetLastUpdatedResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_LastUpdatedResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.GetLastUpdatedResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.LastUpdatedResponse", d.FullName())) } panic("unreachable") } @@ -2329,7 +3152,7 @@ func (x *fastReflection_GetLastUpdatedResponse) WhichOneof(d protoreflect.OneofD // 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_GetLastUpdatedResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_LastUpdatedResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2340,7 +3163,7 @@ func (x *fastReflection_GetLastUpdatedResponse) GetUnknown() protoreflect.RawFie // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_GetLastUpdatedResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_LastUpdatedResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2352,7 +3175,7 @@ func (x *fastReflection_GetLastUpdatedResponse) SetUnknown(fields protoreflect.R // 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_GetLastUpdatedResponse) IsValid() bool { +func (x *fastReflection_LastUpdatedResponse) IsValid() bool { return x != nil } @@ -2362,9 +3185,9 @@ func (x *fastReflection_GetLastUpdatedResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_GetLastUpdatedResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_LastUpdatedResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GetLastUpdatedResponse) + x := input.Message.Interface().(*LastUpdatedResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2389,7 +3212,7 @@ func (x *fastReflection_GetLastUpdatedResponse) ProtoMethods() *protoiface.Metho } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*GetLastUpdatedResponse) + x := input.Message.Interface().(*LastUpdatedResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2424,7 +3247,7 @@ func (x *fastReflection_GetLastUpdatedResponse) ProtoMethods() *protoiface.Metho }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GetLastUpdatedResponse) + x := input.Message.Interface().(*LastUpdatedResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2456,10 +3279,10 @@ func (x *fastReflection_GetLastUpdatedResponse) ProtoMethods() *protoiface.Metho fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetLastUpdatedResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LastUpdatedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GetLastUpdatedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LastUpdatedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -2529,16 +3352,16 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// GetMarketMapRequest is the query request for the GetMarketMap query. +// MarketMapRequest is the query request for the MarketMap query. // It takes no arguments. -type GetMarketMapRequest struct { +type MarketMapRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *GetMarketMapRequest) Reset() { - *x = GetMarketMapRequest{} +func (x *MarketMapRequest) Reset() { + *x = MarketMapRequest{} if protoimpl.UnsafeEnabled { mi := &file_slinky_marketmap_v1_query_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2546,19 +3369,19 @@ func (x *GetMarketMapRequest) Reset() { } } -func (x *GetMarketMapRequest) String() string { +func (x *MarketMapRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMarketMapRequest) ProtoMessage() {} +func (*MarketMapRequest) ProtoMessage() {} -// Deprecated: Use GetMarketMapRequest.ProtoReflect.Descriptor instead. -func (*GetMarketMapRequest) Descriptor() ([]byte, []int) { +// Deprecated: Use MarketMapRequest.ProtoReflect.Descriptor instead. +func (*MarketMapRequest) Descriptor() ([]byte, []int) { return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{0} } -// GetMarketMapResponse is the query response for the GetMarketMap query. -type GetMarketMapResponse struct { +// MarketMapResponse is the query response for the MarketMap query. +type MarketMapResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2570,15 +3393,12 @@ type GetMarketMapResponse struct { // This field can be used as an optimization for clients checking if there // is a new update to the map. LastUpdated uint64 `protobuf:"varint,2,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - // Version is the schema version for the MarketMap data structure and query - // response. - Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` // ChainId is the chain identifier for the market map. - ChainId string `protobuf:"bytes,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (x *GetMarketMapResponse) Reset() { - *x = GetMarketMapResponse{} +func (x *MarketMapResponse) Reset() { + *x = MarketMapResponse{} if protoimpl.UnsafeEnabled { mi := &file_slinky_marketmap_v1_query_proto_msgTypes[1] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2586,43 +3406,112 @@ func (x *GetMarketMapResponse) Reset() { } } -func (x *GetMarketMapResponse) String() string { +func (x *MarketMapResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetMarketMapResponse) ProtoMessage() {} +func (*MarketMapResponse) ProtoMessage() {} -// Deprecated: Use GetMarketMapResponse.ProtoReflect.Descriptor instead. -func (*GetMarketMapResponse) Descriptor() ([]byte, []int) { +// Deprecated: Use MarketMapResponse.ProtoReflect.Descriptor instead. +func (*MarketMapResponse) Descriptor() ([]byte, []int) { return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{1} } -func (x *GetMarketMapResponse) GetMarketMap() *MarketMap { +func (x *MarketMapResponse) GetMarketMap() *MarketMap { if x != nil { return x.MarketMap } return nil } -func (x *GetMarketMapResponse) GetLastUpdated() uint64 { +func (x *MarketMapResponse) GetLastUpdated() uint64 { if x != nil { return x.LastUpdated } return 0 } -func (x *GetMarketMapResponse) GetVersion() uint64 { +func (x *MarketMapResponse) GetChainId() string { if x != nil { - return x.Version + return x.ChainId } - return 0 + return "" +} + +// MarketRequest is the query request for the Market query. +// It takes the currency pair of the market as an argument. +type MarketRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // CurrencyPair is the currency pair associated with the market being + // requested. + CurrencyPair *v1.CurrencyPair `protobuf:"bytes,3,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair,omitempty"` +} + +func (x *MarketRequest) Reset() { + *x = MarketRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MarketRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarketRequest) ProtoMessage() {} + +// Deprecated: Use MarketRequest.ProtoReflect.Descriptor instead. +func (*MarketRequest) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{2} } -func (x *GetMarketMapResponse) GetChainId() string { +func (x *MarketRequest) GetCurrencyPair() *v1.CurrencyPair { if x != nil { - return x.ChainId + return x.CurrencyPair + } + return nil +} + +// MarketResponse is the query response for the Market query. +type MarketResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Market is the configuration of a single market to be price-fetched for. + Market *Market `protobuf:"bytes,1,opt,name=market,proto3" json:"market,omitempty"` +} + +func (x *MarketResponse) Reset() { + *x = MarketResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return "" +} + +func (x *MarketResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MarketResponse) ProtoMessage() {} + +// Deprecated: Use MarketResponse.ProtoReflect.Descriptor instead. +func (*MarketResponse) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{3} +} + +func (x *MarketResponse) GetMarket() *Market { + if x != nil { + return x.Market + } + return nil } // ParamsRequest is the request type for the Query/Params RPC method. @@ -2635,7 +3524,7 @@ type ParamsRequest struct { func (x *ParamsRequest) Reset() { *x = ParamsRequest{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[2] + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2649,7 +3538,7 @@ func (*ParamsRequest) ProtoMessage() {} // Deprecated: Use ParamsRequest.ProtoReflect.Descriptor instead. func (*ParamsRequest) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{2} + return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{4} } // ParamsResponse is the response type for the Query/Params RPC method. @@ -2664,7 +3553,7 @@ type ParamsResponse struct { func (x *ParamsResponse) Reset() { *x = ParamsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[3] + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2678,7 +3567,7 @@ func (*ParamsResponse) ProtoMessage() {} // Deprecated: Use ParamsResponse.ProtoReflect.Descriptor instead. func (*ParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{3} + return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{5} } func (x *ParamsResponse) GetParams() *Params { @@ -2688,37 +3577,37 @@ func (x *ParamsResponse) GetParams() *Params { return nil } -// GetLastUpdatedRequest is the request type for the Query/LastUpdated RPC +// LastUpdatedRequest is the request type for the Query/LastUpdated RPC // method. -type GetLastUpdatedRequest struct { +type LastUpdatedRequest struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *GetLastUpdatedRequest) Reset() { - *x = GetLastUpdatedRequest{} +func (x *LastUpdatedRequest) Reset() { + *x = LastUpdatedRequest{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[4] + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[6] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *GetLastUpdatedRequest) String() string { +func (x *LastUpdatedRequest) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetLastUpdatedRequest) ProtoMessage() {} +func (*LastUpdatedRequest) ProtoMessage() {} -// Deprecated: Use GetLastUpdatedRequest.ProtoReflect.Descriptor instead. -func (*GetLastUpdatedRequest) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{4} +// Deprecated: Use LastUpdatedRequest.ProtoReflect.Descriptor instead. +func (*LastUpdatedRequest) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{6} } -// GetLastUpdatedResponse is the response type for the Query/LastUpdated RPC +// LastUpdatedResponse is the response type for the Query/LastUpdated RPC // method. -type GetLastUpdatedResponse struct { +type LastUpdatedResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields @@ -2726,27 +3615,27 @@ type GetLastUpdatedResponse struct { LastUpdated uint64 `protobuf:"varint,1,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` } -func (x *GetLastUpdatedResponse) Reset() { - *x = GetLastUpdatedResponse{} +func (x *LastUpdatedResponse) Reset() { + *x = LastUpdatedResponse{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_query_proto_msgTypes[5] + mi := &file_slinky_marketmap_v1_query_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *GetLastUpdatedResponse) String() string { +func (x *LastUpdatedResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*GetLastUpdatedResponse) ProtoMessage() {} +func (*LastUpdatedResponse) ProtoMessage() {} -// Deprecated: Use GetLastUpdatedResponse.ProtoReflect.Descriptor instead. -func (*GetLastUpdatedResponse) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{5} +// Deprecated: Use LastUpdatedResponse.ProtoReflect.Descriptor instead. +func (*LastUpdatedResponse) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_query_proto_rawDescGZIP(), []int{7} } -func (x *GetLastUpdatedResponse) GetLastUpdated() uint64 { +func (x *LastUpdatedResponse) GetLastUpdated() uint64 { if x != nil { return x.LastUpdated } @@ -2762,74 +3651,92 @@ var file_slinky_marketmap_v1_query_proto_rawDesc = []byte{ 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, - 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x15, - 0x0a, 0x13, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0xb3, 0x01, 0x0a, 0x14, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, - 0x0a, 0x0a, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, - 0x61, 0x70, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x4d, 0x61, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, - 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, - 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, - 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, - 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, 0x64, 0x18, 0x04, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, 0x22, 0x0f, 0x0a, 0x0d, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4b, 0x0a, 0x0e, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, - 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, + 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, 0x73, 0x6c, 0x69, 0x6e, + 0x6b, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, 0x63, 0x75, 0x72, 0x72, + 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, + 0x20, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, + 0x6f, 0x1a, 0x20, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x96, 0x01, 0x0a, 0x11, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x43, 0x0a, + 0x0a, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, + 0x70, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, + 0x61, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x69, + 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x64, + 0x22, 0x59, 0x0a, 0x0d, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x48, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, + 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, + 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, + 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x63, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x22, 0x4b, 0x0a, 0x0e, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, + 0x06, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, + 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, + 0x52, 0x06, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x22, 0x0f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x4b, 0x0a, 0x0e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x39, 0x0a, 0x06, 0x70, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, + 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x14, 0x0a, 0x12, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x38, 0x0a, 0x13, + 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x32, 0x8a, 0x04, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, + 0x12, 0x82, 0x01, 0x0a, 0x09, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x25, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, - 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x17, 0x0a, 0x15, 0x47, 0x65, 0x74, - 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x3b, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, - 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x32, - 0x9e, 0x03, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x88, 0x01, 0x0a, 0x09, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x28, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, - 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x29, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x12, 0x91, 0x01, 0x0a, 0x0b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x64, 0x12, 0x2a, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, - 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x2b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x47, 0x65, 0x74, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x29, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x12, 0x21, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x61, 0x73, 0x74, - 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x76, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, - 0x42, 0xc5, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, - 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, - 0x4d, 0x58, 0xaa, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, - 0x1f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x15, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x26, 0x82, + 0xd3, 0xe4, 0x93, 0x02, 0x20, 0x12, 0x1e, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x76, 0x0a, 0x06, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x12, + 0x22, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, + 0x12, 0x1b, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x12, 0x8b, 0x01, + 0x0a, 0x0b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x27, 0x2e, + 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x28, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, 0x73, + 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x29, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x23, 0x12, 0x21, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, + 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6c, + 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x76, 0x0a, 0x06, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x22, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x23, 0x2e, 0x73, 0x6c, 0x69, 0x6e, + 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, + 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, + 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x42, 0xc5, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, + 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x42, + 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, + 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x31, 0xa2, + 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x53, 0x6c, + 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, + 0x31, 0xe2, 0x02, 0x1f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, + 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -2844,31 +3751,39 @@ func file_slinky_marketmap_v1_query_proto_rawDescGZIP() []byte { return file_slinky_marketmap_v1_query_proto_rawDescData } -var file_slinky_marketmap_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 6) +var file_slinky_marketmap_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_slinky_marketmap_v1_query_proto_goTypes = []interface{}{ - (*GetMarketMapRequest)(nil), // 0: slinky.marketmap.v1.GetMarketMapRequest - (*GetMarketMapResponse)(nil), // 1: slinky.marketmap.v1.GetMarketMapResponse - (*ParamsRequest)(nil), // 2: slinky.marketmap.v1.ParamsRequest - (*ParamsResponse)(nil), // 3: slinky.marketmap.v1.ParamsResponse - (*GetLastUpdatedRequest)(nil), // 4: slinky.marketmap.v1.GetLastUpdatedRequest - (*GetLastUpdatedResponse)(nil), // 5: slinky.marketmap.v1.GetLastUpdatedResponse - (*MarketMap)(nil), // 6: slinky.marketmap.v1.MarketMap - (*Params)(nil), // 7: slinky.marketmap.v1.Params + (*MarketMapRequest)(nil), // 0: slinky.marketmap.v1.MarketMapRequest + (*MarketMapResponse)(nil), // 1: slinky.marketmap.v1.MarketMapResponse + (*MarketRequest)(nil), // 2: slinky.marketmap.v1.MarketRequest + (*MarketResponse)(nil), // 3: slinky.marketmap.v1.MarketResponse + (*ParamsRequest)(nil), // 4: slinky.marketmap.v1.ParamsRequest + (*ParamsResponse)(nil), // 5: slinky.marketmap.v1.ParamsResponse + (*LastUpdatedRequest)(nil), // 6: slinky.marketmap.v1.LastUpdatedRequest + (*LastUpdatedResponse)(nil), // 7: slinky.marketmap.v1.LastUpdatedResponse + (*MarketMap)(nil), // 8: slinky.marketmap.v1.MarketMap + (*v1.CurrencyPair)(nil), // 9: slinky.types.v1.CurrencyPair + (*Market)(nil), // 10: slinky.marketmap.v1.Market + (*Params)(nil), // 11: slinky.marketmap.v1.Params } var file_slinky_marketmap_v1_query_proto_depIdxs = []int32{ - 6, // 0: slinky.marketmap.v1.GetMarketMapResponse.market_map:type_name -> slinky.marketmap.v1.MarketMap - 7, // 1: slinky.marketmap.v1.ParamsResponse.params:type_name -> slinky.marketmap.v1.Params - 0, // 2: slinky.marketmap.v1.Query.MarketMap:input_type -> slinky.marketmap.v1.GetMarketMapRequest - 4, // 3: slinky.marketmap.v1.Query.LastUpdated:input_type -> slinky.marketmap.v1.GetLastUpdatedRequest - 2, // 4: slinky.marketmap.v1.Query.Params:input_type -> slinky.marketmap.v1.ParamsRequest - 1, // 5: slinky.marketmap.v1.Query.MarketMap:output_type -> slinky.marketmap.v1.GetMarketMapResponse - 5, // 6: slinky.marketmap.v1.Query.LastUpdated:output_type -> slinky.marketmap.v1.GetLastUpdatedResponse - 3, // 7: slinky.marketmap.v1.Query.Params:output_type -> slinky.marketmap.v1.ParamsResponse - 5, // [5:8] is the sub-list for method output_type - 2, // [2:5] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name + 8, // 0: slinky.marketmap.v1.MarketMapResponse.market_map:type_name -> slinky.marketmap.v1.MarketMap + 9, // 1: slinky.marketmap.v1.MarketRequest.currency_pair:type_name -> slinky.types.v1.CurrencyPair + 10, // 2: slinky.marketmap.v1.MarketResponse.market:type_name -> slinky.marketmap.v1.Market + 11, // 3: slinky.marketmap.v1.ParamsResponse.params:type_name -> slinky.marketmap.v1.Params + 0, // 4: slinky.marketmap.v1.Query.MarketMap:input_type -> slinky.marketmap.v1.MarketMapRequest + 2, // 5: slinky.marketmap.v1.Query.Market:input_type -> slinky.marketmap.v1.MarketRequest + 6, // 6: slinky.marketmap.v1.Query.LastUpdated:input_type -> slinky.marketmap.v1.LastUpdatedRequest + 4, // 7: slinky.marketmap.v1.Query.Params:input_type -> slinky.marketmap.v1.ParamsRequest + 1, // 8: slinky.marketmap.v1.Query.MarketMap:output_type -> slinky.marketmap.v1.MarketMapResponse + 3, // 9: slinky.marketmap.v1.Query.Market:output_type -> slinky.marketmap.v1.MarketResponse + 7, // 10: slinky.marketmap.v1.Query.LastUpdated:output_type -> slinky.marketmap.v1.LastUpdatedResponse + 5, // 11: slinky.marketmap.v1.Query.Params:output_type -> slinky.marketmap.v1.ParamsResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name } func init() { file_slinky_marketmap_v1_query_proto_init() } @@ -2880,7 +3795,7 @@ func file_slinky_marketmap_v1_query_proto_init() { file_slinky_marketmap_v1_params_proto_init() if !protoimpl.UnsafeEnabled { file_slinky_marketmap_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMarketMapRequest); i { + switch v := v.(*MarketMapRequest); i { case 0: return &v.state case 1: @@ -2892,7 +3807,7 @@ func file_slinky_marketmap_v1_query_proto_init() { } } file_slinky_marketmap_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetMarketMapResponse); i { + switch v := v.(*MarketMapResponse); i { case 0: return &v.state case 1: @@ -2904,7 +3819,7 @@ func file_slinky_marketmap_v1_query_proto_init() { } } file_slinky_marketmap_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsRequest); i { + switch v := v.(*MarketRequest); i { case 0: return &v.state case 1: @@ -2916,7 +3831,7 @@ func file_slinky_marketmap_v1_query_proto_init() { } } file_slinky_marketmap_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsResponse); i { + switch v := v.(*MarketResponse); i { case 0: return &v.state case 1: @@ -2928,7 +3843,7 @@ func file_slinky_marketmap_v1_query_proto_init() { } } file_slinky_marketmap_v1_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetLastUpdatedRequest); i { + switch v := v.(*ParamsRequest); i { case 0: return &v.state case 1: @@ -2940,7 +3855,31 @@ func file_slinky_marketmap_v1_query_proto_init() { } } file_slinky_marketmap_v1_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GetLastUpdatedResponse); i { + switch v := v.(*ParamsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_slinky_marketmap_v1_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LastUpdatedRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_slinky_marketmap_v1_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LastUpdatedResponse); i { case 0: return &v.state case 1: @@ -2958,7 +3897,7 @@ func file_slinky_marketmap_v1_query_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_slinky_marketmap_v1_query_proto_rawDesc, NumEnums: 0, - NumMessages: 6, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/slinky/marketmap/v1/query_grpc.pb.go b/api/slinky/marketmap/v1/query_grpc.pb.go index c6342ed55..ecdb03a21 100644 --- a/api/slinky/marketmap/v1/query_grpc.pb.go +++ b/api/slinky/marketmap/v1/query_grpc.pb.go @@ -20,6 +20,7 @@ const _ = grpc.SupportPackageIsVersion7 const ( Query_MarketMap_FullMethodName = "/slinky.marketmap.v1.Query/MarketMap" + Query_Market_FullMethodName = "/slinky.marketmap.v1.Query/Market" Query_LastUpdated_FullMethodName = "/slinky.marketmap.v1.Query/LastUpdated" Query_Params_FullMethodName = "/slinky.marketmap.v1.Query/Params" ) @@ -30,9 +31,12 @@ const ( type QueryClient interface { // MarketMap returns the full market map stored in the x/marketmap // module. - MarketMap(ctx context.Context, in *GetMarketMapRequest, opts ...grpc.CallOption) (*GetMarketMapResponse, error) + MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) + // Market returns a market stored in the x/marketmap + // module. + Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) // LastUpdated returns the last height the market map was updated at. - LastUpdated(ctx context.Context, in *GetLastUpdatedRequest, opts ...grpc.CallOption) (*GetLastUpdatedResponse, error) + LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) // Params returns the current x/marketmap module parameters. Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) } @@ -45,8 +49,8 @@ func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { return &queryClient{cc} } -func (c *queryClient) MarketMap(ctx context.Context, in *GetMarketMapRequest, opts ...grpc.CallOption) (*GetMarketMapResponse, error) { - out := new(GetMarketMapResponse) +func (c *queryClient) MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) { + out := new(MarketMapResponse) err := c.cc.Invoke(ctx, Query_MarketMap_FullMethodName, in, out, opts...) if err != nil { return nil, err @@ -54,8 +58,17 @@ func (c *queryClient) MarketMap(ctx context.Context, in *GetMarketMapRequest, op return out, nil } -func (c *queryClient) LastUpdated(ctx context.Context, in *GetLastUpdatedRequest, opts ...grpc.CallOption) (*GetLastUpdatedResponse, error) { - out := new(GetLastUpdatedResponse) +func (c *queryClient) Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) { + out := new(MarketResponse) + err := c.cc.Invoke(ctx, Query_Market_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) { + out := new(LastUpdatedResponse) err := c.cc.Invoke(ctx, Query_LastUpdated_FullMethodName, in, out, opts...) if err != nil { return nil, err @@ -78,9 +91,12 @@ func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grp type QueryServer interface { // MarketMap returns the full market map stored in the x/marketmap // module. - MarketMap(context.Context, *GetMarketMapRequest) (*GetMarketMapResponse, error) + MarketMap(context.Context, *MarketMapRequest) (*MarketMapResponse, error) + // Market returns a market stored in the x/marketmap + // module. + Market(context.Context, *MarketRequest) (*MarketResponse, error) // LastUpdated returns the last height the market map was updated at. - LastUpdated(context.Context, *GetLastUpdatedRequest) (*GetLastUpdatedResponse, error) + LastUpdated(context.Context, *LastUpdatedRequest) (*LastUpdatedResponse, error) // Params returns the current x/marketmap module parameters. Params(context.Context, *ParamsRequest) (*ParamsResponse, error) mustEmbedUnimplementedQueryServer() @@ -90,10 +106,13 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (UnimplementedQueryServer) MarketMap(context.Context, *GetMarketMapRequest) (*GetMarketMapResponse, error) { +func (UnimplementedQueryServer) MarketMap(context.Context, *MarketMapRequest) (*MarketMapResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MarketMap not implemented") } -func (UnimplementedQueryServer) LastUpdated(context.Context, *GetLastUpdatedRequest) (*GetLastUpdatedResponse, error) { +func (UnimplementedQueryServer) Market(context.Context, *MarketRequest) (*MarketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Market not implemented") +} +func (UnimplementedQueryServer) LastUpdated(context.Context, *LastUpdatedRequest) (*LastUpdatedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LastUpdated not implemented") } func (UnimplementedQueryServer) Params(context.Context, *ParamsRequest) (*ParamsResponse, error) { @@ -113,7 +132,7 @@ func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { } func _Query_MarketMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMarketMapRequest) + in := new(MarketMapRequest) if err := dec(in); err != nil { return nil, err } @@ -125,13 +144,31 @@ func _Query_MarketMap_Handler(srv interface{}, ctx context.Context, dec func(int FullMethod: Query_MarketMap_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MarketMap(ctx, req.(*GetMarketMapRequest)) + return srv.(QueryServer).MarketMap(ctx, req.(*MarketMapRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Market_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Market(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Query_Market_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Market(ctx, req.(*MarketRequest)) } return interceptor(ctx, in, info, handler) } func _Query_LastUpdated_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetLastUpdatedRequest) + in := new(LastUpdatedRequest) if err := dec(in); err != nil { return nil, err } @@ -143,7 +180,7 @@ func _Query_LastUpdated_Handler(srv interface{}, ctx context.Context, dec func(i FullMethod: Query_LastUpdated_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastUpdated(ctx, req.(*GetLastUpdatedRequest)) + return srv.(QueryServer).LastUpdated(ctx, req.(*LastUpdatedRequest)) } return interceptor(ctx, in, info, handler) } @@ -177,6 +214,10 @@ var Query_ServiceDesc = grpc.ServiceDesc{ MethodName: "MarketMap", Handler: _Query_MarketMap_Handler, }, + { + MethodName: "Market", + Handler: _Query_Market_Handler, + }, { MethodName: "LastUpdated", Handler: _Query_LastUpdated_Handler, diff --git a/api/slinky/marketmap/v1/tx.pulsar.go b/api/slinky/marketmap/v1/tx.pulsar.go index 605b74fe8..726df568f 100644 --- a/api/slinky/marketmap/v1/tx.pulsar.go +++ b/api/slinky/marketmap/v1/tx.pulsar.go @@ -16,30 +16,79 @@ import ( sync "sync" ) +var _ protoreflect.List = (*_MsgCreateMarkets_2_list)(nil) + +type _MsgCreateMarkets_2_list struct { + list *[]*Market +} + +func (x *_MsgCreateMarkets_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgCreateMarkets_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgCreateMarkets_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Market) + (*x.list)[i] = concreteValue +} + +func (x *_MsgCreateMarkets_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Market) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgCreateMarkets_2_list) AppendMutable() protoreflect.Value { + v := new(Market) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateMarkets_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgCreateMarkets_2_list) NewElement() protoreflect.Value { + v := new(Market) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgCreateMarkets_2_list) IsValid() bool { + return x.list != nil +} + var ( - md_CreateMarket protoreflect.MessageDescriptor - fd_CreateMarket_ticker protoreflect.FieldDescriptor - fd_CreateMarket_providers protoreflect.FieldDescriptor - fd_CreateMarket_paths protoreflect.FieldDescriptor + md_MsgCreateMarkets protoreflect.MessageDescriptor + fd_MsgCreateMarkets_authority protoreflect.FieldDescriptor + fd_MsgCreateMarkets_create_markets protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_tx_proto_init() - md_CreateMarket = File_slinky_marketmap_v1_tx_proto.Messages().ByName("CreateMarket") - fd_CreateMarket_ticker = md_CreateMarket.Fields().ByName("ticker") - fd_CreateMarket_providers = md_CreateMarket.Fields().ByName("providers") - fd_CreateMarket_paths = md_CreateMarket.Fields().ByName("paths") + md_MsgCreateMarkets = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgCreateMarkets") + fd_MsgCreateMarkets_authority = md_MsgCreateMarkets.Fields().ByName("authority") + fd_MsgCreateMarkets_create_markets = md_MsgCreateMarkets.Fields().ByName("create_markets") } -var _ protoreflect.Message = (*fastReflection_CreateMarket)(nil) +var _ protoreflect.Message = (*fastReflection_MsgCreateMarkets)(nil) -type fastReflection_CreateMarket CreateMarket +type fastReflection_MsgCreateMarkets MsgCreateMarkets -func (x *CreateMarket) ProtoReflect() protoreflect.Message { - return (*fastReflection_CreateMarket)(x) +func (x *MsgCreateMarkets) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateMarkets)(x) } -func (x *CreateMarket) slowProtoReflect() protoreflect.Message { +func (x *MsgCreateMarkets) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -51,43 +100,43 @@ func (x *CreateMarket) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_CreateMarket_messageType fastReflection_CreateMarket_messageType -var _ protoreflect.MessageType = fastReflection_CreateMarket_messageType{} +var _fastReflection_MsgCreateMarkets_messageType fastReflection_MsgCreateMarkets_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateMarkets_messageType{} -type fastReflection_CreateMarket_messageType struct{} +type fastReflection_MsgCreateMarkets_messageType struct{} -func (x fastReflection_CreateMarket_messageType) Zero() protoreflect.Message { - return (*fastReflection_CreateMarket)(nil) +func (x fastReflection_MsgCreateMarkets_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateMarkets)(nil) } -func (x fastReflection_CreateMarket_messageType) New() protoreflect.Message { - return new(fastReflection_CreateMarket) +func (x fastReflection_MsgCreateMarkets_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateMarkets) } -func (x fastReflection_CreateMarket_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_CreateMarket +func (x fastReflection_MsgCreateMarkets_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateMarkets } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_CreateMarket) Descriptor() protoreflect.MessageDescriptor { - return md_CreateMarket +func (x *fastReflection_MsgCreateMarkets) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateMarkets } // 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_CreateMarket) Type() protoreflect.MessageType { - return _fastReflection_CreateMarket_messageType +func (x *fastReflection_MsgCreateMarkets) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateMarkets_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_CreateMarket) New() protoreflect.Message { - return new(fastReflection_CreateMarket) +func (x *fastReflection_MsgCreateMarkets) New() protoreflect.Message { + return new(fastReflection_MsgCreateMarkets) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_CreateMarket) Interface() protoreflect.ProtoMessage { - return (*CreateMarket)(x) +func (x *fastReflection_MsgCreateMarkets) Interface() protoreflect.ProtoMessage { + return (*MsgCreateMarkets)(x) } // Range iterates over every populated field in an undefined order, @@ -95,22 +144,16 @@ func (x *fastReflection_CreateMarket) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_CreateMarket) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Ticker != nil { - value := protoreflect.ValueOfMessage(x.Ticker.ProtoReflect()) - if !f(fd_CreateMarket_ticker, value) { - return - } - } - if x.Providers != nil { - value := protoreflect.ValueOfMessage(x.Providers.ProtoReflect()) - if !f(fd_CreateMarket_providers, value) { +func (x *fastReflection_MsgCreateMarkets) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgCreateMarkets_authority, value) { return } } - if x.Paths != nil { - value := protoreflect.ValueOfMessage(x.Paths.ProtoReflect()) - if !f(fd_CreateMarket_paths, value) { + if len(x.CreateMarkets) != 0 { + value := protoreflect.ValueOfList(&_MsgCreateMarkets_2_list{list: &x.CreateMarkets}) + if !f(fd_MsgCreateMarkets_create_markets, value) { return } } @@ -127,19 +170,17 @@ func (x *fastReflection_CreateMarket) Range(f func(protoreflect.FieldDescriptor, // 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_CreateMarket) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgCreateMarkets) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.CreateMarket.ticker": - return x.Ticker != nil - case "slinky.marketmap.v1.CreateMarket.providers": - return x.Providers != nil - case "slinky.marketmap.v1.CreateMarket.paths": - return x.Paths != nil + case "slinky.marketmap.v1.MsgCreateMarkets.authority": + return x.Authority != "" + case "slinky.marketmap.v1.MsgCreateMarkets.create_markets": + return len(x.CreateMarkets) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.CreateMarket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarkets")) } - panic(fmt.Errorf("message slinky.marketmap.v1.CreateMarket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarkets does not contain field %s", fd.FullName())) } } @@ -149,19 +190,17 @@ func (x *fastReflection_CreateMarket) Has(fd protoreflect.FieldDescriptor) bool // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CreateMarket) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgCreateMarkets) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.CreateMarket.ticker": - x.Ticker = nil - case "slinky.marketmap.v1.CreateMarket.providers": - x.Providers = nil - case "slinky.marketmap.v1.CreateMarket.paths": - x.Paths = nil + case "slinky.marketmap.v1.MsgCreateMarkets.authority": + x.Authority = "" + case "slinky.marketmap.v1.MsgCreateMarkets.create_markets": + x.CreateMarkets = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.CreateMarket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarkets")) } - panic(fmt.Errorf("message slinky.marketmap.v1.CreateMarket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarkets does not contain field %s", fd.FullName())) } } @@ -171,22 +210,22 @@ func (x *fastReflection_CreateMarket) Clear(fd protoreflect.FieldDescriptor) { // 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_CreateMarket) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateMarkets) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.CreateMarket.ticker": - value := x.Ticker - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.marketmap.v1.CreateMarket.providers": - value := x.Providers - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.marketmap.v1.CreateMarket.paths": - value := x.Paths - return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "slinky.marketmap.v1.MsgCreateMarkets.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "slinky.marketmap.v1.MsgCreateMarkets.create_markets": + if len(x.CreateMarkets) == 0 { + return protoreflect.ValueOfList(&_MsgCreateMarkets_2_list{}) + } + listValue := &_MsgCreateMarkets_2_list{list: &x.CreateMarkets} + return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.CreateMarket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarkets")) } - panic(fmt.Errorf("message slinky.marketmap.v1.CreateMarket does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarkets does not contain field %s", descriptor.FullName())) } } @@ -200,19 +239,19 @@ func (x *fastReflection_CreateMarket) Get(descriptor protoreflect.FieldDescripto // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CreateMarket) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgCreateMarkets) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.CreateMarket.ticker": - x.Ticker = value.Message().Interface().(*Ticker) - case "slinky.marketmap.v1.CreateMarket.providers": - x.Providers = value.Message().Interface().(*Providers) - case "slinky.marketmap.v1.CreateMarket.paths": - x.Paths = value.Message().Interface().(*Paths) + case "slinky.marketmap.v1.MsgCreateMarkets.authority": + x.Authority = value.Interface().(string) + case "slinky.marketmap.v1.MsgCreateMarkets.create_markets": + lv := value.List() + clv := lv.(*_MsgCreateMarkets_2_list) + x.CreateMarkets = *clv.list default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.CreateMarket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarkets")) } - panic(fmt.Errorf("message slinky.marketmap.v1.CreateMarket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarkets does not contain field %s", fd.FullName())) } } @@ -226,60 +265,49 @@ func (x *fastReflection_CreateMarket) Set(fd protoreflect.FieldDescriptor, value // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CreateMarket) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateMarkets) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.CreateMarket.ticker": - if x.Ticker == nil { - x.Ticker = new(Ticker) - } - return protoreflect.ValueOfMessage(x.Ticker.ProtoReflect()) - case "slinky.marketmap.v1.CreateMarket.providers": - if x.Providers == nil { - x.Providers = new(Providers) - } - return protoreflect.ValueOfMessage(x.Providers.ProtoReflect()) - case "slinky.marketmap.v1.CreateMarket.paths": - if x.Paths == nil { - x.Paths = new(Paths) + case "slinky.marketmap.v1.MsgCreateMarkets.create_markets": + if x.CreateMarkets == nil { + x.CreateMarkets = []*Market{} } - return protoreflect.ValueOfMessage(x.Paths.ProtoReflect()) + value := &_MsgCreateMarkets_2_list{list: &x.CreateMarkets} + return protoreflect.ValueOfList(value) + case "slinky.marketmap.v1.MsgCreateMarkets.authority": + panic(fmt.Errorf("field authority of message slinky.marketmap.v1.MsgCreateMarkets is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.CreateMarket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarkets")) } - panic(fmt.Errorf("message slinky.marketmap.v1.CreateMarket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarkets 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_CreateMarket) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateMarkets) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.CreateMarket.ticker": - m := new(Ticker) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.marketmap.v1.CreateMarket.providers": - m := new(Providers) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.marketmap.v1.CreateMarket.paths": - m := new(Paths) - return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "slinky.marketmap.v1.MsgCreateMarkets.authority": + return protoreflect.ValueOfString("") + case "slinky.marketmap.v1.MsgCreateMarkets.create_markets": + list := []*Market{} + return protoreflect.ValueOfList(&_MsgCreateMarkets_2_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.CreateMarket")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarkets")) } - panic(fmt.Errorf("message slinky.marketmap.v1.CreateMarket does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarkets 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_CreateMarket) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgCreateMarkets) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.CreateMarket", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgCreateMarkets", d.FullName())) } panic("unreachable") } @@ -287,7 +315,7 @@ func (x *fastReflection_CreateMarket) WhichOneof(d protoreflect.OneofDescriptor) // 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_CreateMarket) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgCreateMarkets) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -298,7 +326,7 @@ func (x *fastReflection_CreateMarket) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_CreateMarket) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgCreateMarkets) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -310,7 +338,7 @@ func (x *fastReflection_CreateMarket) SetUnknown(fields protoreflect.RawFields) // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_CreateMarket) IsValid() bool { +func (x *fastReflection_MsgCreateMarkets) IsValid() bool { return x != nil } @@ -320,9 +348,9 @@ func (x *fastReflection_CreateMarket) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgCreateMarkets) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*CreateMarket) + x := input.Message.Interface().(*MsgCreateMarkets) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -334,17 +362,15 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.Ticker != nil { - l = options.Size(x.Ticker) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Providers != nil { - l = options.Size(x.Providers) + l = len(x.Authority) + if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - if x.Paths != nil { - l = options.Size(x.Paths) - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.CreateMarkets) > 0 { + for _, e := range x.CreateMarkets { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } } if x.unknownFields != nil { n += len(x.unknownFields) @@ -356,7 +382,7 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*CreateMarket) + x := input.Message.Interface().(*MsgCreateMarkets) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -375,45 +401,26 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.Paths != nil { - encoded, err := options.Marshal(x.Paths) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if x.Providers != nil { - encoded, err := options.Marshal(x.Providers) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err + if len(x.CreateMarkets) > 0 { + for iNdEx := len(x.CreateMarkets) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.CreateMarkets[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 } - if x.Ticker != nil { - encoded, err := options.Marshal(x.Ticker) - 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))) + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) i-- dAtA[i] = 0xa } @@ -428,7 +435,7 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*CreateMarket) + x := input.Message.Interface().(*MsgCreateMarkets) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -460,17 +467,17 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CreateMarket: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateMarkets: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: CreateMarket: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateMarkets: 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 Ticker", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -480,67 +487,27 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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 } - if x.Ticker == nil { - x.Ticker = &Ticker{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Ticker); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Providers", 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.Providers == nil { - x.Providers = &Providers{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Providers); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CreateMarkets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -567,10 +534,8 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - if x.Paths == nil { - x.Paths = &Paths{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Paths); err != nil { + x.CreateMarkets = append(x.CreateMarkets, &Market{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CreateMarkets[len(x.CreateMarkets)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex @@ -609,79 +574,24 @@ func (x *fastReflection_CreateMarket) ProtoMethods() *protoiface.Methods { } } -var _ protoreflect.List = (*_MsgUpdateMarketMap_2_list)(nil) - -type _MsgUpdateMarketMap_2_list struct { - list *[]*CreateMarket -} - -func (x *_MsgUpdateMarketMap_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgUpdateMarketMap_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgUpdateMarketMap_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*CreateMarket) - (*x.list)[i] = concreteValue -} - -func (x *_MsgUpdateMarketMap_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*CreateMarket) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgUpdateMarketMap_2_list) AppendMutable() protoreflect.Value { - v := new(CreateMarket) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgUpdateMarketMap_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgUpdateMarketMap_2_list) NewElement() protoreflect.Value { - v := new(CreateMarket) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgUpdateMarketMap_2_list) IsValid() bool { - return x.list != nil -} - var ( - md_MsgUpdateMarketMap protoreflect.MessageDescriptor - fd_MsgUpdateMarketMap_signer protoreflect.FieldDescriptor - fd_MsgUpdateMarketMap_create_markets protoreflect.FieldDescriptor + md_MsgCreateMarketsResponse protoreflect.MessageDescriptor ) func init() { file_slinky_marketmap_v1_tx_proto_init() - md_MsgUpdateMarketMap = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgUpdateMarketMap") - fd_MsgUpdateMarketMap_signer = md_MsgUpdateMarketMap.Fields().ByName("signer") - fd_MsgUpdateMarketMap_create_markets = md_MsgUpdateMarketMap.Fields().ByName("create_markets") + md_MsgCreateMarketsResponse = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgCreateMarketsResponse") } -var _ protoreflect.Message = (*fastReflection_MsgUpdateMarketMap)(nil) +var _ protoreflect.Message = (*fastReflection_MsgCreateMarketsResponse)(nil) -type fastReflection_MsgUpdateMarketMap MsgUpdateMarketMap +type fastReflection_MsgCreateMarketsResponse MsgCreateMarketsResponse -func (x *MsgUpdateMarketMap) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateMarketMap)(x) +func (x *MsgCreateMarketsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgCreateMarketsResponse)(x) } -func (x *MsgUpdateMarketMap) slowProtoReflect() protoreflect.Message { +func (x *MsgCreateMarketsResponse) slowProtoReflect() protoreflect.Message { mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[1] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -693,43 +603,43 @@ func (x *MsgUpdateMarketMap) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgUpdateMarketMap_messageType fastReflection_MsgUpdateMarketMap_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateMarketMap_messageType{} +var _fastReflection_MsgCreateMarketsResponse_messageType fastReflection_MsgCreateMarketsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgCreateMarketsResponse_messageType{} -type fastReflection_MsgUpdateMarketMap_messageType struct{} +type fastReflection_MsgCreateMarketsResponse_messageType struct{} -func (x fastReflection_MsgUpdateMarketMap_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateMarketMap)(nil) +func (x fastReflection_MsgCreateMarketsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgCreateMarketsResponse)(nil) } -func (x fastReflection_MsgUpdateMarketMap_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarketMap) +func (x fastReflection_MsgCreateMarketsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgCreateMarketsResponse) } -func (x fastReflection_MsgUpdateMarketMap_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarketMap +func (x fastReflection_MsgCreateMarketsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateMarketsResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgUpdateMarketMap) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarketMap +func (x *fastReflection_MsgCreateMarketsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgCreateMarketsResponse } // 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_MsgUpdateMarketMap) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateMarketMap_messageType +func (x *fastReflection_MsgCreateMarketsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgCreateMarketsResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateMarketMap) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarketMap) +func (x *fastReflection_MsgCreateMarketsResponse) New() protoreflect.Message { + return new(fastReflection_MsgCreateMarketsResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateMarketMap) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateMarketMap)(x) +func (x *fastReflection_MsgCreateMarketsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgCreateMarketsResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -737,19 +647,7 @@ func (x *fastReflection_MsgUpdateMarketMap) Interface() protoreflect.ProtoMessag // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgUpdateMarketMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Signer != "" { - value := protoreflect.ValueOfString(x.Signer) - if !f(fd_MsgUpdateMarketMap_signer, value) { - return - } - } - if len(x.CreateMarkets) != 0 { - value := protoreflect.ValueOfList(&_MsgUpdateMarketMap_2_list{list: &x.CreateMarkets}) - if !f(fd_MsgUpdateMarketMap_create_markets, value) { - return - } - } +func (x *fastReflection_MsgCreateMarketsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -763,17 +661,13 @@ func (x *fastReflection_MsgUpdateMarketMap) Range(f func(protoreflect.FieldDescr // In other cases (aside from the nullable cases above), // a proto3 scalar field is populated if it contains a non-zero value, and // a repeated field is populated if it is non-empty. -func (x *fastReflection_MsgUpdateMarketMap) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgCreateMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.MsgUpdateMarketMap.signer": - return x.Signer != "" - case "slinky.marketmap.v1.MsgUpdateMarketMap.create_markets": - return len(x.CreateMarkets) != 0 default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMap")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarketsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMap does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarketsResponse does not contain field %s", fd.FullName())) } } @@ -783,17 +677,13 @@ func (x *fastReflection_MsgUpdateMarketMap) Has(fd protoreflect.FieldDescriptor) // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMap) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgCreateMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.MsgUpdateMarketMap.signer": - x.Signer = "" - case "slinky.marketmap.v1.MsgUpdateMarketMap.create_markets": - x.CreateMarkets = nil default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMap")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarketsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMap does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarketsResponse does not contain field %s", fd.FullName())) } } @@ -803,22 +693,1313 @@ func (x *fastReflection_MsgUpdateMarketMap) Clear(fd protoreflect.FieldDescripto // the default value of a bytes scalar is guaranteed to be a copy. // For unpopulated composite types, it returns an empty, read-only view // of the value; to obtain a mutable reference, use Mutable. -func (x *fastReflection_MsgUpdateMarketMap) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgCreateMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.MsgUpdateMarketMap.signer": - value := x.Signer + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgCreateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgCreateMarketsResponse", 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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgCreateMarketsResponse) + 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().(*MsgCreateMarketsResponse) + 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().(*MsgCreateMarketsResponse) + 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: MsgCreateMarketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateMarketsResponse: 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, + } +} + +var _ protoreflect.List = (*_MsgUpdateMarkets_2_list)(nil) + +type _MsgUpdateMarkets_2_list struct { + list *[]*Market +} + +func (x *_MsgUpdateMarkets_2_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgUpdateMarkets_2_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) +} + +func (x *_MsgUpdateMarkets_2_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Market) + (*x.list)[i] = concreteValue +} + +func (x *_MsgUpdateMarkets_2_list) Append(value protoreflect.Value) { + valueUnwrapped := value.Message() + concreteValue := valueUnwrapped.Interface().(*Market) + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgUpdateMarkets_2_list) AppendMutable() protoreflect.Value { + v := new(Market) + *x.list = append(*x.list, v) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgUpdateMarkets_2_list) Truncate(n int) { + for i := n; i < len(*x.list); i++ { + (*x.list)[i] = nil + } + *x.list = (*x.list)[:n] +} + +func (x *_MsgUpdateMarkets_2_list) NewElement() protoreflect.Value { + v := new(Market) + return protoreflect.ValueOfMessage(v.ProtoReflect()) +} + +func (x *_MsgUpdateMarkets_2_list) IsValid() bool { + return x.list != nil +} + +var ( + md_MsgUpdateMarkets protoreflect.MessageDescriptor + fd_MsgUpdateMarkets_authority protoreflect.FieldDescriptor + fd_MsgUpdateMarkets_update_markets protoreflect.FieldDescriptor +) + +func init() { + file_slinky_marketmap_v1_tx_proto_init() + md_MsgUpdateMarkets = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgUpdateMarkets") + fd_MsgUpdateMarkets_authority = md_MsgUpdateMarkets.Fields().ByName("authority") + fd_MsgUpdateMarkets_update_markets = md_MsgUpdateMarkets.Fields().ByName("update_markets") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateMarkets)(nil) + +type fastReflection_MsgUpdateMarkets MsgUpdateMarkets + +func (x *MsgUpdateMarkets) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateMarkets)(x) +} + +func (x *MsgUpdateMarkets) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_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_MsgUpdateMarkets_messageType fastReflection_MsgUpdateMarkets_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateMarkets_messageType{} + +type fastReflection_MsgUpdateMarkets_messageType struct{} + +func (x fastReflection_MsgUpdateMarkets_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateMarkets)(nil) +} +func (x fastReflection_MsgUpdateMarkets_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateMarkets) +} +func (x fastReflection_MsgUpdateMarkets_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateMarkets +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateMarkets) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateMarkets +} + +// 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_MsgUpdateMarkets) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateMarkets_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateMarkets) New() protoreflect.Message { + return new(fastReflection_MsgUpdateMarkets) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateMarkets) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateMarkets)(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_MsgUpdateMarkets) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgUpdateMarkets_authority, value) { + return + } + } + if len(x.UpdateMarkets) != 0 { + value := protoreflect.ValueOfList(&_MsgUpdateMarkets_2_list{list: &x.UpdateMarkets}) + if !f(fd_MsgUpdateMarkets_update_markets, 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_MsgUpdateMarkets) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgUpdateMarkets.authority": + return x.Authority != "" + case "slinky.marketmap.v1.MsgUpdateMarkets.update_markets": + return len(x.UpdateMarkets) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarkets")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgUpdateMarkets.authority": + x.Authority = "" + case "slinky.marketmap.v1.MsgUpdateMarkets.update_markets": + x.UpdateMarkets = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarkets")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "slinky.marketmap.v1.MsgUpdateMarkets.authority": + value := x.Authority + return protoreflect.ValueOfString(value) + case "slinky.marketmap.v1.MsgUpdateMarkets.update_markets": + if len(x.UpdateMarkets) == 0 { + return protoreflect.ValueOfList(&_MsgUpdateMarkets_2_list{}) + } + listValue := &_MsgUpdateMarkets_2_list{list: &x.UpdateMarkets} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarkets")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgUpdateMarkets.authority": + x.Authority = value.Interface().(string) + case "slinky.marketmap.v1.MsgUpdateMarkets.update_markets": + lv := value.List() + clv := lv.(*_MsgUpdateMarkets_2_list) + x.UpdateMarkets = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarkets")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgUpdateMarkets.update_markets": + if x.UpdateMarkets == nil { + x.UpdateMarkets = []*Market{} + } + value := &_MsgUpdateMarkets_2_list{list: &x.UpdateMarkets} + return protoreflect.ValueOfList(value) + case "slinky.marketmap.v1.MsgUpdateMarkets.authority": + panic(fmt.Errorf("field authority of message slinky.marketmap.v1.MsgUpdateMarkets is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarkets")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgUpdateMarkets.authority": + return protoreflect.ValueOfString("") + case "slinky.marketmap.v1.MsgUpdateMarkets.update_markets": + list := []*Market{} + return protoreflect.ValueOfList(&_MsgUpdateMarkets_2_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarkets")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgUpdateMarkets", 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_MsgUpdateMarkets) 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_MsgUpdateMarkets) 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_MsgUpdateMarkets) 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_MsgUpdateMarkets) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateMarkets) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.UpdateMarkets) > 0 { + for _, e := range x.UpdateMarkets { + l = options.Size(e) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateMarkets) + 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.UpdateMarkets) > 0 { + for iNdEx := len(x.UpdateMarkets) - 1; iNdEx >= 0; iNdEx-- { + encoded, err := options.Marshal(x.UpdateMarkets[iNdEx]) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) + i-- + dAtA[i] = 0x12 + } + } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0xa + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*MsgUpdateMarkets) + 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: MsgUpdateMarkets: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field UpdateMarkets", 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.UpdateMarkets = append(x.UpdateMarkets, &Market{}) + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.UpdateMarkets[len(x.UpdateMarkets)-1]); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + +var ( + md_MsgUpdateMarketsResponse protoreflect.MessageDescriptor +) + +func init() { + file_slinky_marketmap_v1_tx_proto_init() + md_MsgUpdateMarketsResponse = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgUpdateMarketsResponse") +} + +var _ protoreflect.Message = (*fastReflection_MsgUpdateMarketsResponse)(nil) + +type fastReflection_MsgUpdateMarketsResponse MsgUpdateMarketsResponse + +func (x *MsgUpdateMarketsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgUpdateMarketsResponse)(x) +} + +func (x *MsgUpdateMarketsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_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_MsgUpdateMarketsResponse_messageType fastReflection_MsgUpdateMarketsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgUpdateMarketsResponse_messageType{} + +type fastReflection_MsgUpdateMarketsResponse_messageType struct{} + +func (x fastReflection_MsgUpdateMarketsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgUpdateMarketsResponse)(nil) +} +func (x fastReflection_MsgUpdateMarketsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgUpdateMarketsResponse) +} +func (x fastReflection_MsgUpdateMarketsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateMarketsResponse +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgUpdateMarketsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgUpdateMarketsResponse +} + +// 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_MsgUpdateMarketsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgUpdateMarketsResponse_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgUpdateMarketsResponse) New() protoreflect.Message { + return new(fastReflection_MsgUpdateMarketsResponse) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgUpdateMarketsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgUpdateMarketsResponse)(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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketsResponse")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgUpdateMarketsResponse", 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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*MsgUpdateMarketsResponse) + 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().(*MsgUpdateMarketsResponse) + 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().(*MsgUpdateMarketsResponse) + 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: MsgUpdateMarketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarketsResponse: 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, + } +} + +var ( + md_MsgParams protoreflect.MessageDescriptor + fd_MsgParams_params protoreflect.FieldDescriptor + fd_MsgParams_authority protoreflect.FieldDescriptor +) + +func init() { + file_slinky_marketmap_v1_tx_proto_init() + md_MsgParams = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgParams") + fd_MsgParams_params = md_MsgParams.Fields().ByName("params") + fd_MsgParams_authority = md_MsgParams.Fields().ByName("authority") +} + +var _ protoreflect.Message = (*fastReflection_MsgParams)(nil) + +type fastReflection_MsgParams MsgParams + +func (x *MsgParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgParams)(x) +} + +func (x *MsgParams) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[4] + 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_MsgParams_messageType fastReflection_MsgParams_messageType +var _ protoreflect.MessageType = fastReflection_MsgParams_messageType{} + +type fastReflection_MsgParams_messageType struct{} + +func (x fastReflection_MsgParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgParams)(nil) +} +func (x fastReflection_MsgParams_messageType) New() protoreflect.Message { + return new(fastReflection_MsgParams) +} +func (x fastReflection_MsgParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParams +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_MsgParams) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParams +} + +// 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_MsgParams) Type() protoreflect.MessageType { + return _fastReflection_MsgParams_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_MsgParams) New() protoreflect.Message { + return new(fastReflection_MsgParams) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_MsgParams) Interface() protoreflect.ProtoMessage { + return (*MsgParams)(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_MsgParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.Params != nil { + value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + if !f(fd_MsgParams_params, value) { + return + } + } + if x.Authority != "" { + value := protoreflect.ValueOfString(x.Authority) + if !f(fd_MsgParams_authority, 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_MsgParams) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgParams.params": + return x.Params != nil + case "slinky.marketmap.v1.MsgParams.authority": + return x.Authority != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams 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_MsgParams) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "slinky.marketmap.v1.MsgParams.params": + x.Params = nil + case "slinky.marketmap.v1.MsgParams.authority": + x.Authority = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + } + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams 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_MsgParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "slinky.marketmap.v1.MsgParams.params": + value := x.Params + return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "slinky.marketmap.v1.MsgParams.authority": + value := x.Authority return protoreflect.ValueOfString(value) - case "slinky.marketmap.v1.MsgUpdateMarketMap.create_markets": - if len(x.CreateMarkets) == 0 { - return protoreflect.ValueOfList(&_MsgUpdateMarketMap_2_list{}) - } - listValue := &_MsgUpdateMarketMap_2_list{list: &x.CreateMarkets} - return protoreflect.ValueOfList(listValue) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMap")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMap does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", descriptor.FullName())) } } @@ -832,19 +2013,17 @@ func (x *fastReflection_MsgUpdateMarketMap) Get(descriptor protoreflect.FieldDes // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMap) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.MsgUpdateMarketMap.signer": - x.Signer = value.Interface().(string) - case "slinky.marketmap.v1.MsgUpdateMarketMap.create_markets": - lv := value.List() - clv := lv.(*_MsgUpdateMarketMap_2_list) - x.CreateMarkets = *clv.list + case "slinky.marketmap.v1.MsgParams.params": + x.Params = value.Message().Interface().(*Params) + case "slinky.marketmap.v1.MsgParams.authority": + x.Authority = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMap")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMap does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", fd.FullName())) } } @@ -858,49 +2037,48 @@ func (x *fastReflection_MsgUpdateMarketMap) Set(fd protoreflect.FieldDescriptor, // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMap) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.MsgUpdateMarketMap.create_markets": - if x.CreateMarkets == nil { - x.CreateMarkets = []*CreateMarket{} + case "slinky.marketmap.v1.MsgParams.params": + if x.Params == nil { + x.Params = new(Params) } - value := &_MsgUpdateMarketMap_2_list{list: &x.CreateMarkets} - return protoreflect.ValueOfList(value) - case "slinky.marketmap.v1.MsgUpdateMarketMap.signer": - panic(fmt.Errorf("field signer of message slinky.marketmap.v1.MsgUpdateMarketMap is not mutable")) + return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) + case "slinky.marketmap.v1.MsgParams.authority": + panic(fmt.Errorf("field authority of message slinky.marketmap.v1.MsgParams is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMap")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMap does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams 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_MsgUpdateMarketMap) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.MsgUpdateMarketMap.signer": + case "slinky.marketmap.v1.MsgParams.params": + m := new(Params) + return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "slinky.marketmap.v1.MsgParams.authority": return protoreflect.ValueOfString("") - case "slinky.marketmap.v1.MsgUpdateMarketMap.create_markets": - list := []*CreateMarket{} - return protoreflect.ValueOfList(&_MsgUpdateMarketMap_2_list{list: &list}) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMap")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMap does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams 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_MsgUpdateMarketMap) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgUpdateMarketMap", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgParams", d.FullName())) } panic("unreachable") } @@ -908,7 +2086,7 @@ func (x *fastReflection_MsgUpdateMarketMap) WhichOneof(d protoreflect.OneofDescr // GetUnknown retrieves the entire list of unknown fields. // The caller may only mutate the contents of the RawFields // if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_MsgUpdateMarketMap) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgParams) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -919,7 +2097,7 @@ func (x *fastReflection_MsgUpdateMarketMap) GetUnknown() protoreflect.RawFields // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMap) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgParams) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -931,7 +2109,7 @@ func (x *fastReflection_MsgUpdateMarketMap) SetUnknown(fields protoreflect.RawFi // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgUpdateMarketMap) IsValid() bool { +func (x *fastReflection_MsgParams) IsValid() bool { return x != nil } @@ -941,9 +2119,9 @@ func (x *fastReflection_MsgUpdateMarketMap) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateMarketMap) + x := input.Message.Interface().(*MsgParams) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -955,15 +2133,13 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - l = len(x.Signer) - if l > 0 { + if x.Params != nil { + l = options.Size(x.Params) n += 1 + l + runtime.Sov(uint64(l)) } - if len(x.CreateMarkets) > 0 { - for _, e := range x.CreateMarkets { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } + l = len(x.Authority) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) } if x.unknownFields != nil { n += len(x.unknownFields) @@ -975,7 +2151,7 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateMarketMap) + x := input.Message.Interface().(*MsgParams) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -994,26 +2170,24 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.CreateMarkets) > 0 { - for iNdEx := len(x.CreateMarkets) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.CreateMarkets[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } + if len(x.Authority) > 0 { + i -= len(x.Authority) + copy(dAtA[i:], x.Authority) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + i-- + dAtA[i] = 0x12 } - if len(x.Signer) > 0 { - i -= len(x.Signer) - copy(dAtA[i:], x.Signer) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Signer))) + if x.Params != nil { + encoded, err := options.Marshal(x.Params) + if err != nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, err + } + i -= len(encoded) + copy(dAtA[i:], encoded) + i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) i-- dAtA[i] = 0xa } @@ -1028,7 +2202,7 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateMarketMap) + x := input.Message.Interface().(*MsgParams) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1060,17 +2234,17 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarketMap: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarketMap: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: 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 Signer", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1080,29 +2254,33 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Signer = string(dAtA[iNdEx:postIndex]) + if x.Params == nil { + x.Params = &Params{} + } + if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } iNdEx = postIndex case 2: if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CreateMarkets", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1112,25 +2290,23 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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.CreateMarkets = append(x.CreateMarkets, &CreateMarket{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CreateMarkets[len(x.CreateMarkets)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -1168,24 +2344,24 @@ func (x *fastReflection_MsgUpdateMarketMap) ProtoMethods() *protoiface.Methods { } var ( - md_MsgUpdateMarketMapResponse protoreflect.MessageDescriptor + md_MsgParamsResponse protoreflect.MessageDescriptor ) func init() { file_slinky_marketmap_v1_tx_proto_init() - md_MsgUpdateMarketMapResponse = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgUpdateMarketMapResponse") + md_MsgParamsResponse = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgParamsResponse") } -var _ protoreflect.Message = (*fastReflection_MsgUpdateMarketMapResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgParamsResponse)(nil) -type fastReflection_MsgUpdateMarketMapResponse MsgUpdateMarketMapResponse +type fastReflection_MsgParamsResponse MsgParamsResponse -func (x *MsgUpdateMarketMapResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateMarketMapResponse)(x) +func (x *MsgParamsResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgParamsResponse)(x) } -func (x *MsgUpdateMarketMapResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[2] +func (x *MsgParamsResponse) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[5] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1196,43 +2372,43 @@ func (x *MsgUpdateMarketMapResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgUpdateMarketMapResponse_messageType fastReflection_MsgUpdateMarketMapResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateMarketMapResponse_messageType{} +var _fastReflection_MsgParamsResponse_messageType fastReflection_MsgParamsResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgParamsResponse_messageType{} -type fastReflection_MsgUpdateMarketMapResponse_messageType struct{} +type fastReflection_MsgParamsResponse_messageType struct{} -func (x fastReflection_MsgUpdateMarketMapResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateMarketMapResponse)(nil) +func (x fastReflection_MsgParamsResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgParamsResponse)(nil) } -func (x fastReflection_MsgUpdateMarketMapResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarketMapResponse) +func (x fastReflection_MsgParamsResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgParamsResponse) } -func (x fastReflection_MsgUpdateMarketMapResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarketMapResponse +func (x fastReflection_MsgParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParamsResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgUpdateMarketMapResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarketMapResponse +func (x *fastReflection_MsgParamsResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgParamsResponse } // 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_MsgUpdateMarketMapResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateMarketMapResponse_messageType +func (x *fastReflection_MsgParamsResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgParamsResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateMarketMapResponse) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarketMapResponse) +func (x *fastReflection_MsgParamsResponse) New() protoreflect.Message { + return new(fastReflection_MsgParamsResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateMarketMapResponse) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateMarketMapResponse)(x) +func (x *fastReflection_MsgParamsResponse) Interface() protoreflect.ProtoMessage { + return (*MsgParamsResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -1240,7 +2416,7 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) Interface() protoreflect.Pro // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgUpdateMarketMapResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -1254,13 +2430,13 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) Range(f func(protoreflect.Fi // 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_MsgUpdateMarketMapResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) } } @@ -1270,13 +2446,13 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) Has(fd protoreflect.FieldDes // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMapResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgParamsResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) } } @@ -1286,13 +2462,13 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) Clear(fd protoreflect.FieldD // 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_MsgUpdateMarketMapResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMapResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", descriptor.FullName())) } } @@ -1306,13 +2482,13 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) Get(descriptor protoreflect. // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMapResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) } } @@ -1326,36 +2502,36 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) Set(fd protoreflect.FieldDes // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMapResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse 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_MsgUpdateMarketMapResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgUpdateMarketMapResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgUpdateMarketMapResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse 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_MsgUpdateMarketMapResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgUpdateMarketMapResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgParamsResponse", d.FullName())) } panic("unreachable") } @@ -1363,7 +2539,7 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) WhichOneof(d protoreflect.On // 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_MsgUpdateMarketMapResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgParamsResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1374,7 +2550,7 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) GetUnknown() protoreflect.Ra // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgUpdateMarketMapResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgParamsResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1386,7 +2562,7 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) SetUnknown(fields protorefle // 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_MsgUpdateMarketMapResponse) IsValid() bool { +func (x *fastReflection_MsgParamsResponse) IsValid() bool { return x != nil } @@ -1396,9 +2572,9 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgUpdateMarketMapResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgParamsResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateMarketMapResponse) + x := input.Message.Interface().(*MsgParamsResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1420,7 +2596,7 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) ProtoMethods() *protoiface.M } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateMarketMapResponse) + x := input.Message.Interface().(*MsgParamsResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1450,7 +2626,7 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) ProtoMethods() *protoiface.M }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateMarketMapResponse) + x := input.Message.Interface().(*MsgParamsResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1482,10 +2658,10 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) ProtoMethods() *protoiface.M fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarketMapResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarketMapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1523,29 +2699,75 @@ func (x *fastReflection_MsgUpdateMarketMapResponse) ProtoMethods() *protoiface.M } } +var _ protoreflect.List = (*_MsgRemoveMarketAuthorities_1_list)(nil) + +type _MsgRemoveMarketAuthorities_1_list struct { + list *[]string +} + +func (x *_MsgRemoveMarketAuthorities_1_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} + +func (x *_MsgRemoveMarketAuthorities_1_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} + +func (x *_MsgRemoveMarketAuthorities_1_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_MsgRemoveMarketAuthorities_1_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_MsgRemoveMarketAuthorities_1_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveMarketAuthorities at list field RemoveAddresses as it is not of Message kind")) +} + +func (x *_MsgRemoveMarketAuthorities_1_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_MsgRemoveMarketAuthorities_1_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_MsgRemoveMarketAuthorities_1_list) IsValid() bool { + return x.list != nil +} + var ( - md_MsgParams protoreflect.MessageDescriptor - fd_MsgParams_params protoreflect.FieldDescriptor - fd_MsgParams_authority protoreflect.FieldDescriptor + md_MsgRemoveMarketAuthorities protoreflect.MessageDescriptor + fd_MsgRemoveMarketAuthorities_remove_addresses protoreflect.FieldDescriptor + fd_MsgRemoveMarketAuthorities_admin protoreflect.FieldDescriptor ) func init() { file_slinky_marketmap_v1_tx_proto_init() - md_MsgParams = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgParams") - fd_MsgParams_params = md_MsgParams.Fields().ByName("params") - fd_MsgParams_authority = md_MsgParams.Fields().ByName("authority") + md_MsgRemoveMarketAuthorities = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgRemoveMarketAuthorities") + fd_MsgRemoveMarketAuthorities_remove_addresses = md_MsgRemoveMarketAuthorities.Fields().ByName("remove_addresses") + fd_MsgRemoveMarketAuthorities_admin = md_MsgRemoveMarketAuthorities.Fields().ByName("admin") } -var _ protoreflect.Message = (*fastReflection_MsgParams)(nil) +var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketAuthorities)(nil) -type fastReflection_MsgParams MsgParams +type fastReflection_MsgRemoveMarketAuthorities MsgRemoveMarketAuthorities -func (x *MsgParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgParams)(x) +func (x *MsgRemoveMarketAuthorities) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgRemoveMarketAuthorities)(x) } -func (x *MsgParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[3] +func (x *MsgRemoveMarketAuthorities) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[6] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1556,43 +2778,43 @@ func (x *MsgParams) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgParams_messageType fastReflection_MsgParams_messageType -var _ protoreflect.MessageType = fastReflection_MsgParams_messageType{} +var _fastReflection_MsgRemoveMarketAuthorities_messageType fastReflection_MsgRemoveMarketAuthorities_messageType +var _ protoreflect.MessageType = fastReflection_MsgRemoveMarketAuthorities_messageType{} -type fastReflection_MsgParams_messageType struct{} +type fastReflection_MsgRemoveMarketAuthorities_messageType struct{} -func (x fastReflection_MsgParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgParams)(nil) +func (x fastReflection_MsgRemoveMarketAuthorities_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgRemoveMarketAuthorities)(nil) } -func (x fastReflection_MsgParams_messageType) New() protoreflect.Message { - return new(fastReflection_MsgParams) +func (x fastReflection_MsgRemoveMarketAuthorities_messageType) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarketAuthorities) } -func (x fastReflection_MsgParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParams +func (x fastReflection_MsgRemoveMarketAuthorities_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarketAuthorities } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgParams) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParams +func (x *fastReflection_MsgRemoveMarketAuthorities) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarketAuthorities } // 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_MsgParams) Type() protoreflect.MessageType { - return _fastReflection_MsgParams_messageType +func (x *fastReflection_MsgRemoveMarketAuthorities) Type() protoreflect.MessageType { + return _fastReflection_MsgRemoveMarketAuthorities_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgParams) New() protoreflect.Message { - return new(fastReflection_MsgParams) +func (x *fastReflection_MsgRemoveMarketAuthorities) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarketAuthorities) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgParams) Interface() protoreflect.ProtoMessage { - return (*MsgParams)(x) +func (x *fastReflection_MsgRemoveMarketAuthorities) Interface() protoreflect.ProtoMessage { + return (*MsgRemoveMarketAuthorities)(x) } // Range iterates over every populated field in an undefined order, @@ -1600,16 +2822,16 @@ func (x *fastReflection_MsgParams) Interface() protoreflect.ProtoMessage { // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_MsgParams_params, value) { +func (x *fastReflection_MsgRemoveMarketAuthorities) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if len(x.RemoveAddresses) != 0 { + value := protoreflect.ValueOfList(&_MsgRemoveMarketAuthorities_1_list{list: &x.RemoveAddresses}) + if !f(fd_MsgRemoveMarketAuthorities_remove_addresses, value) { return } } - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgParams_authority, value) { + if x.Admin != "" { + value := protoreflect.ValueOfString(x.Admin) + if !f(fd_MsgRemoveMarketAuthorities_admin, value) { return } } @@ -1626,17 +2848,17 @@ func (x *fastReflection_MsgParams) Range(f func(protoreflect.FieldDescriptor, pr // 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_MsgParams) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgRemoveMarketAuthorities) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "slinky.marketmap.v1.MsgParams.params": - return x.Params != nil - case "slinky.marketmap.v1.MsgParams.authority": - return x.Authority != "" + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.remove_addresses": + return len(x.RemoveAddresses) != 0 + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.admin": + return x.Admin != "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthorities")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthorities does not contain field %s", fd.FullName())) } } @@ -1646,17 +2868,17 @@ func (x *fastReflection_MsgParams) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgRemoveMarketAuthorities) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "slinky.marketmap.v1.MsgParams.params": - x.Params = nil - case "slinky.marketmap.v1.MsgParams.authority": - x.Authority = "" + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.remove_addresses": + x.RemoveAddresses = nil + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.admin": + x.Admin = "" default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthorities")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthorities does not contain field %s", fd.FullName())) } } @@ -1666,19 +2888,22 @@ func (x *fastReflection_MsgParams) Clear(fd protoreflect.FieldDescriptor) { // 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_MsgParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgRemoveMarketAuthorities) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "slinky.marketmap.v1.MsgParams.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.marketmap.v1.MsgParams.authority": - value := x.Authority + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.remove_addresses": + if len(x.RemoveAddresses) == 0 { + return protoreflect.ValueOfList(&_MsgRemoveMarketAuthorities_1_list{}) + } + listValue := &_MsgRemoveMarketAuthorities_1_list{list: &x.RemoveAddresses} + return protoreflect.ValueOfList(listValue) + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.admin": + value := x.Admin return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthorities")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthorities does not contain field %s", descriptor.FullName())) } } @@ -1692,17 +2917,19 @@ func (x *fastReflection_MsgParams) Get(descriptor protoreflect.FieldDescriptor) // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgRemoveMarketAuthorities) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "slinky.marketmap.v1.MsgParams.params": - x.Params = value.Message().Interface().(*Params) - case "slinky.marketmap.v1.MsgParams.authority": - x.Authority = value.Interface().(string) + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.remove_addresses": + lv := value.List() + clv := lv.(*_MsgRemoveMarketAuthorities_1_list) + x.RemoveAddresses = *clv.list + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.admin": + x.Admin = value.Interface().(string) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthorities")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthorities does not contain field %s", fd.FullName())) } } @@ -1716,48 +2943,49 @@ func (x *fastReflection_MsgParams) Set(fd protoreflect.FieldDescriptor, value pr // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgRemoveMarketAuthorities) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.MsgParams.params": - if x.Params == nil { - x.Params = new(Params) + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.remove_addresses": + if x.RemoveAddresses == nil { + x.RemoveAddresses = []string{} } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "slinky.marketmap.v1.MsgParams.authority": - panic(fmt.Errorf("field authority of message slinky.marketmap.v1.MsgParams is not mutable")) + value := &_MsgRemoveMarketAuthorities_1_list{list: &x.RemoveAddresses} + return protoreflect.ValueOfList(value) + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.admin": + panic(fmt.Errorf("field admin of message slinky.marketmap.v1.MsgRemoveMarketAuthorities is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthorities")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthorities 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_MsgParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgRemoveMarketAuthorities) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "slinky.marketmap.v1.MsgParams.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.marketmap.v1.MsgParams.authority": + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.remove_addresses": + list := []string{} + return protoreflect.ValueOfList(&_MsgRemoveMarketAuthorities_1_list{list: &list}) + case "slinky.marketmap.v1.MsgRemoveMarketAuthorities.admin": return protoreflect.ValueOfString("") default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParams")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthorities")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParams does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthorities 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_MsgParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgRemoveMarketAuthorities) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgParams", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgRemoveMarketAuthorities", d.FullName())) } panic("unreachable") } @@ -1765,7 +2993,7 @@ func (x *fastReflection_MsgParams) WhichOneof(d protoreflect.OneofDescriptor) pr // 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_MsgParams) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgRemoveMarketAuthorities) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -1776,7 +3004,7 @@ func (x *fastReflection_MsgParams) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParams) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgRemoveMarketAuthorities) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -1788,7 +3016,7 @@ func (x *fastReflection_MsgParams) SetUnknown(fields protoreflect.RawFields) { // message type, but the details are implementation dependent. // Validity is not part of the protobuf data model, and may not // be preserved in marshaling or other operations. -func (x *fastReflection_MsgParams) IsValid() bool { +func (x *fastReflection_MsgRemoveMarketAuthorities) IsValid() bool { return x != nil } @@ -1798,9 +3026,9 @@ func (x *fastReflection_MsgParams) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgRemoveMarketAuthorities) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgParams) + x := input.Message.Interface().(*MsgRemoveMarketAuthorities) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1812,11 +3040,13 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { var n int var l int _ = l - if x.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) + if len(x.RemoveAddresses) > 0 { + for _, s := range x.RemoveAddresses { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } } - l = len(x.Authority) + l = len(x.Admin) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } @@ -1830,7 +3060,7 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgParams) + x := input.Message.Interface().(*MsgRemoveMarketAuthorities) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1849,26 +3079,21 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) + if len(x.Admin) > 0 { + i -= len(x.Admin) + copy(dAtA[i:], x.Admin) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) i-- dAtA[i] = 0x12 } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err + if len(x.RemoveAddresses) > 0 { + for iNdEx := len(x.RemoveAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.RemoveAddresses[iNdEx]) + copy(dAtA[i:], x.RemoveAddresses[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RemoveAddresses[iNdEx]))) + i-- + dAtA[i] = 0xa } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa } if input.Buf != nil { input.Buf = append(input.Buf, dAtA...) @@ -1881,7 +3106,7 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgParams) + x := input.Message.Interface().(*MsgRemoveMarketAuthorities) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -1913,17 +3138,17 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketAuthorities: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketAuthorities: 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 Params", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RemoveAddresses", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow @@ -1933,31 +3158,27 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength } - postIndex := iNdEx + msglen + 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 } - if x.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } + x.RemoveAddresses = append(x.RemoveAddresses, 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 Authority", wireType) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1985,7 +3206,7 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.Authority = string(dAtA[iNdEx:postIndex]) + x.Admin = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -2023,24 +3244,24 @@ func (x *fastReflection_MsgParams) ProtoMethods() *protoiface.Methods { } var ( - md_MsgParamsResponse protoreflect.MessageDescriptor + md_MsgRemoveMarketAuthoritiesResponse protoreflect.MessageDescriptor ) func init() { file_slinky_marketmap_v1_tx_proto_init() - md_MsgParamsResponse = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgParamsResponse") + md_MsgRemoveMarketAuthoritiesResponse = File_slinky_marketmap_v1_tx_proto.Messages().ByName("MsgRemoveMarketAuthoritiesResponse") } -var _ protoreflect.Message = (*fastReflection_MsgParamsResponse)(nil) +var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketAuthoritiesResponse)(nil) -type fastReflection_MsgParamsResponse MsgParamsResponse +type fastReflection_MsgRemoveMarketAuthoritiesResponse MsgRemoveMarketAuthoritiesResponse -func (x *MsgParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgParamsResponse)(x) +func (x *MsgRemoveMarketAuthoritiesResponse) ProtoReflect() protoreflect.Message { + return (*fastReflection_MsgRemoveMarketAuthoritiesResponse)(x) } -func (x *MsgParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[4] +func (x *MsgRemoveMarketAuthoritiesResponse) slowProtoReflect() protoreflect.Message { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[7] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -2051,43 +3272,43 @@ func (x *MsgParamsResponse) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_MsgParamsResponse_messageType fastReflection_MsgParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgParamsResponse_messageType{} +var _fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType +var _ protoreflect.MessageType = fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType{} -type fastReflection_MsgParamsResponse_messageType struct{} +type fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType struct{} -func (x fastReflection_MsgParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgParamsResponse)(nil) +func (x fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType) Zero() protoreflect.Message { + return (*fastReflection_MsgRemoveMarketAuthoritiesResponse)(nil) } -func (x fastReflection_MsgParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgParamsResponse) +func (x fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarketAuthoritiesResponse) } -func (x fastReflection_MsgParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParamsResponse +func (x fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarketAuthoritiesResponse } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_MsgParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParamsResponse +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Descriptor() protoreflect.MessageDescriptor { + return md_MsgRemoveMarketAuthoritiesResponse } // 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_MsgParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgParamsResponse_messageType +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Type() protoreflect.MessageType { + return _fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgParamsResponse) New() protoreflect.Message { - return new(fastReflection_MsgParamsResponse) +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) New() protoreflect.Message { + return new(fastReflection_MsgRemoveMarketAuthoritiesResponse) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgParamsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgParamsResponse)(x) +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Interface() protoreflect.ProtoMessage { + return (*MsgRemoveMarketAuthoritiesResponse)(x) } // Range iterates over every populated field in an undefined order, @@ -2095,7 +3316,7 @@ func (x *fastReflection_MsgParamsResponse) Interface() protoreflect.ProtoMessage // Range returns immediately if f returns false. // While iterating, mutating operations may only be performed // on the current field descriptor. -func (x *fastReflection_MsgParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { } // Has reports whether a field is populated. @@ -2109,13 +3330,13 @@ func (x *fastReflection_MsgParamsResponse) Range(f func(protoreflect.FieldDescri // 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_MsgParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse does not contain field %s", fd.FullName())) } } @@ -2125,13 +3346,13 @@ func (x *fastReflection_MsgParamsResponse) Has(fd protoreflect.FieldDescriptor) // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse does not contain field %s", fd.FullName())) } } @@ -2141,13 +3362,13 @@ func (x *fastReflection_MsgParamsResponse) Clear(fd protoreflect.FieldDescriptor // 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_MsgParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse does not contain field %s", descriptor.FullName())) } } @@ -2161,13 +3382,13 @@ func (x *fastReflection_MsgParamsResponse) Get(descriptor protoreflect.FieldDesc // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse does not contain field %s", fd.FullName())) } } @@ -2181,36 +3402,36 @@ func (x *fastReflection_MsgParamsResponse) Set(fd protoreflect.FieldDescriptor, // It panics if the field does not contain a composite type. // // Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgParamsResponse")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse")) } - panic(fmt.Errorf("message slinky.marketmap.v1.MsgParamsResponse does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgParamsResponse", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse", d.FullName())) } panic("unreachable") } @@ -2218,7 +3439,7 @@ func (x *fastReflection_MsgParamsResponse) WhichOneof(d protoreflect.OneofDescri // 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_MsgParamsResponse) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -2229,7 +3450,7 @@ func (x *fastReflection_MsgParamsResponse) GetUnknown() protoreflect.RawFields { // An empty RawFields may be passed to clear the fields. // // SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_MsgParamsResponse) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -2241,7 +3462,7 @@ func (x *fastReflection_MsgParamsResponse) SetUnknown(fields protoreflect.RawFie // 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_MsgParamsResponse) IsValid() bool { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) IsValid() bool { return x != nil } @@ -2251,9 +3472,9 @@ func (x *fastReflection_MsgParamsResponse) IsValid() bool { // The returned methods type is identical to // "google.golang.org/protobuf/runtime/protoiface".Methods. // Consult the protoiface package documentation for details. -func (x *fastReflection_MsgParamsResponse) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgParamsResponse) + x := input.Message.Interface().(*MsgRemoveMarketAuthoritiesResponse) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2275,7 +3496,7 @@ func (x *fastReflection_MsgParamsResponse) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgParamsResponse) + x := input.Message.Interface().(*MsgRemoveMarketAuthoritiesResponse) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2305,7 +3526,7 @@ func (x *fastReflection_MsgParamsResponse) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgParamsResponse) + x := input.Message.Interface().(*MsgRemoveMarketAuthoritiesResponse) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -2337,10 +3558,10 @@ func (x *fastReflection_MsgParamsResponse) ProtoMethods() *protoiface.Methods { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketAuthoritiesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketAuthoritiesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -2391,25 +3612,23 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// CreateMarket contains all information needed to create a new market. -type CreateMarket struct { +// MsgCreateMarkets defines a message carrying a payload for creating markets in +// the x/marketmap module. +type MsgCreateMarkets struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Ticker is the on-chain representation of the ticker. This is the target - // ticker that the prices of the set of tickers will be converted to. - Ticker *Ticker `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"` - // Providers maps provider names to their off-chain - // representations for the given ticker of the message. - Providers *Providers `protobuf:"bytes,2,opt,name=providers,proto3" json:"providers,omitempty"` - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - Paths *Paths `protobuf:"bytes,3,opt,name=paths,proto3" json:"paths,omitempty"` + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // CreateMarkets is the list of all markets to be created for the given + // transaction. + CreateMarkets []*Market `protobuf:"bytes,2,rep,name=create_markets,json=createMarkets,proto3" json:"create_markets,omitempty"` } -func (x *CreateMarket) Reset() { - *x = CreateMarket{} +func (x *MsgCreateMarkets) Reset() { + *x = MsgCreateMarkets{} if protoimpl.UnsafeEnabled { mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[0] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -2417,111 +3636,132 @@ func (x *CreateMarket) Reset() { } } -func (x *CreateMarket) String() string { +func (x *MsgCreateMarkets) String() string { return protoimpl.X.MessageStringOf(x) } -func (*CreateMarket) ProtoMessage() {} +func (*MsgCreateMarkets) ProtoMessage() {} -// Deprecated: Use CreateMarket.ProtoReflect.Descriptor instead. -func (*CreateMarket) Descriptor() ([]byte, []int) { +// Deprecated: Use MsgCreateMarkets.ProtoReflect.Descriptor instead. +func (*MsgCreateMarkets) Descriptor() ([]byte, []int) { return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{0} } -func (x *CreateMarket) GetTicker() *Ticker { +func (x *MsgCreateMarkets) GetAuthority() string { if x != nil { - return x.Ticker + return x.Authority } - return nil + return "" } -func (x *CreateMarket) GetProviders() *Providers { +func (x *MsgCreateMarkets) GetCreateMarkets() []*Market { if x != nil { - return x.Providers + return x.CreateMarkets } return nil } -func (x *CreateMarket) GetPaths() *Paths { - if x != nil { - return x.Paths +// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. +type MsgCreateMarketsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgCreateMarketsResponse) Reset() { + *x = MsgCreateMarketsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) } - return nil } -// MsgUpdateMarketMap defines a message carrying a payload for updating the +func (x *MsgCreateMarketsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgCreateMarketsResponse) ProtoMessage() {} + +// Deprecated: Use MsgCreateMarketsResponse.ProtoReflect.Descriptor instead. +func (*MsgCreateMarketsResponse) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{1} +} + +// MsgUpdateMarkets defines a message carrying a payload for updating the // x/marketmap module. -type MsgUpdateMarketMap struct { +type MsgUpdateMarkets struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - // Signer is the signer of this transaction. - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // CreateMarkets is the list of all markets to be created for the given + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // UpdateMarkets is the list of all markets to be updated for the given // transaction. - CreateMarkets []*CreateMarket `protobuf:"bytes,2,rep,name=create_markets,json=createMarkets,proto3" json:"create_markets,omitempty"` + UpdateMarkets []*Market `protobuf:"bytes,2,rep,name=update_markets,json=updateMarkets,proto3" json:"update_markets,omitempty"` } -func (x *MsgUpdateMarketMap) Reset() { - *x = MsgUpdateMarketMap{} +func (x *MsgUpdateMarkets) Reset() { + *x = MsgUpdateMarkets{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[1] + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[2] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgUpdateMarketMap) String() string { +func (x *MsgUpdateMarkets) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgUpdateMarketMap) ProtoMessage() {} +func (*MsgUpdateMarkets) ProtoMessage() {} -// Deprecated: Use MsgUpdateMarketMap.ProtoReflect.Descriptor instead. -func (*MsgUpdateMarketMap) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{1} +// Deprecated: Use MsgUpdateMarkets.ProtoReflect.Descriptor instead. +func (*MsgUpdateMarkets) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{2} } -func (x *MsgUpdateMarketMap) GetSigner() string { +func (x *MsgUpdateMarkets) GetAuthority() string { if x != nil { - return x.Signer + return x.Authority } return "" } -func (x *MsgUpdateMarketMap) GetCreateMarkets() []*CreateMarket { +func (x *MsgUpdateMarkets) GetUpdateMarkets() []*Market { if x != nil { - return x.CreateMarkets + return x.UpdateMarkets } return nil } -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -type MsgUpdateMarketMapResponse struct { +// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. +type MsgUpdateMarketsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields } -func (x *MsgUpdateMarketMapResponse) Reset() { - *x = MsgUpdateMarketMapResponse{} +func (x *MsgUpdateMarketsResponse) Reset() { + *x = MsgUpdateMarketsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[2] + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[3] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } } -func (x *MsgUpdateMarketMapResponse) String() string { +func (x *MsgUpdateMarketsResponse) String() string { return protoimpl.X.MessageStringOf(x) } -func (*MsgUpdateMarketMapResponse) ProtoMessage() {} +func (*MsgUpdateMarketsResponse) ProtoMessage() {} -// Deprecated: Use MsgUpdateMarketMapResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateMarketMapResponse) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{2} +// Deprecated: Use MsgUpdateMarketsResponse.ProtoReflect.Descriptor instead. +func (*MsgUpdateMarketsResponse) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{3} } // MsgParams defines the Msg/Params request type. It contains the @@ -2541,7 +3781,7 @@ type MsgParams struct { func (x *MsgParams) Reset() { *x = MsgParams{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[3] + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[4] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2555,7 +3795,7 @@ func (*MsgParams) ProtoMessage() {} // Deprecated: Use MsgParams.ProtoReflect.Descriptor instead. func (*MsgParams) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{3} + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{4} } func (x *MsgParams) GetParams() *Params { @@ -2582,7 +3822,7 @@ type MsgParamsResponse struct { func (x *MsgParamsResponse) Reset() { *x = MsgParamsResponse{} if protoimpl.UnsafeEnabled { - mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[4] + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[5] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -2596,7 +3836,84 @@ func (*MsgParamsResponse) ProtoMessage() {} // Deprecated: Use MsgParamsResponse.ProtoReflect.Descriptor instead. func (*MsgParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{4} + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{5} +} + +// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse +// request type. It contains the new addresses to remove from the list of +// authorities +type MsgRemoveMarketAuthorities struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // RemoveAddresses is the list of addresses to remove. + RemoveAddresses []string `protobuf:"bytes,1,rep,name=remove_addresses,json=removeAddresses,proto3" json:"remove_addresses,omitempty"` + // Admin defines the authority that is the x/marketmap + // Admin account. This account is set in the module parameters. + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` +} + +func (x *MsgRemoveMarketAuthorities) Reset() { + *x = MsgRemoveMarketAuthorities{} + if protoimpl.UnsafeEnabled { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRemoveMarketAuthorities) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRemoveMarketAuthorities) ProtoMessage() {} + +// Deprecated: Use MsgRemoveMarketAuthorities.ProtoReflect.Descriptor instead. +func (*MsgRemoveMarketAuthorities) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{6} +} + +func (x *MsgRemoveMarketAuthorities) GetRemoveAddresses() []string { + if x != nil { + return x.RemoveAddresses + } + return nil +} + +func (x *MsgRemoveMarketAuthorities) GetAdmin() string { + if x != nil { + return x.Admin + } + return "" +} + +// MsgRemoveMarketAuthoritiesResponse defines the +// Msg/RemoveMarketAuthoritiesResponse response type. +type MsgRemoveMarketAuthoritiesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *MsgRemoveMarketAuthoritiesResponse) Reset() { + *x = MsgRemoveMarketAuthoritiesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_slinky_marketmap_v1_tx_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *MsgRemoveMarketAuthoritiesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*MsgRemoveMarketAuthoritiesResponse) ProtoMessage() {} + +// Deprecated: Use MsgRemoveMarketAuthoritiesResponse.ProtoReflect.Descriptor instead. +func (*MsgRemoveMarketAuthoritiesResponse) Descriptor() ([]byte, []int) { + return file_slinky_marketmap_v1_tx_proto_rawDescGZIP(), []int{7} } var File_slinky_marketmap_v1_tx_proto protoreflect.FileDescriptor @@ -2615,70 +3932,98 @@ var file_slinky_marketmap_v1_tx_proto_rawDesc = []byte{ 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xc5, 0x01, 0x0a, 0x0c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x12, 0x39, 0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x54, 0x69, 0x63, 0x6b, - 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, - 0x12, 0x42, 0x0a, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x73, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x70, 0x72, 0x6f, 0x76, 0x69, - 0x64, 0x65, 0x72, 0x73, 0x12, 0x36, 0x0a, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x74, 0x68, 0x73, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x70, 0x61, 0x74, 0x68, 0x73, 0x22, 0xd1, 0x01, 0x0a, - 0x12, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x4d, 0x61, 0x70, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, - 0x69, 0x67, 0x6e, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x21, 0x2e, + 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xd0, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, + 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, + 0x79, 0x12, 0x48, 0x0a, 0x0e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, + 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x63, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x3a, 0xe8, 0xa0, 0x1f, + 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, + 0xe7, 0xb0, 0x2a, 0x23, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x6d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0xd0, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, + 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, + 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, + 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, + 0x12, 0x48, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, + 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x75, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x3a, 0xe8, 0xa0, 0x1f, 0x00, + 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, + 0xb0, 0x2a, 0x23, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, + 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, + 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x8e, 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x39, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x1b, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, + 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, + 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, + 0x69, 0x74, 0x79, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, 0x01, 0x0a, 0x1a, 0x4d, 0x73, 0x67, + 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, + 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x76, + 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, + 0x09, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, + 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x05, 0x61, 0x64, 0x6d, + 0x69, 0x6e, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x24, + 0x0a, 0x22, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xb2, 0x03, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x65, 0x0a, 0x0d, + 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x25, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x39, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x06, - 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x25, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, - 0x22, 0x1c, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x8e, - 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x39, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, - 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, - 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, - 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, - 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, - 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xcb, 0x01, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x6b, 0x0a, 0x0f, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, - 0x27, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, - 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x1a, 0x2f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, + 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x65, 0x0a, 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, + 0x6b, 0x65, 0x74, 0x73, 0x12, 0x25, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x2d, 0x2e, 0x73, 0x6c, + 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, + 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, + 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x06, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x83, 0x01, 0x0a, + 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, + 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x2f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, - 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x50, 0x0a, 0x06, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x1e, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x1a, 0x26, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, - 0x2a, 0x01, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x07, - 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, - 0x58, 0xaa, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, - 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, - 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x15, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, + 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x1a, 0x37, 0x2e, 0x73, 0x6c, 0x69, 0x6e, + 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x76, 0x31, 0x2e, + 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, + 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0xc2, 0x01, 0x0a, 0x17, 0x63, 0x6f, + 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, + 0x61, 0x70, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, + 0x5a, 0x30, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, + 0x6d, 0x61, 0x70, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, + 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, + 0x79, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2e, 0x56, 0x31, 0xca, 0x02, + 0x13, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, + 0x70, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x1f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x61, + 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, + 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, + 0x3a, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -2693,33 +4038,36 @@ func file_slinky_marketmap_v1_tx_proto_rawDescGZIP() []byte { return file_slinky_marketmap_v1_tx_proto_rawDescData } -var file_slinky_marketmap_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 5) +var file_slinky_marketmap_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) var file_slinky_marketmap_v1_tx_proto_goTypes = []interface{}{ - (*CreateMarket)(nil), // 0: slinky.marketmap.v1.CreateMarket - (*MsgUpdateMarketMap)(nil), // 1: slinky.marketmap.v1.MsgUpdateMarketMap - (*MsgUpdateMarketMapResponse)(nil), // 2: slinky.marketmap.v1.MsgUpdateMarketMapResponse - (*MsgParams)(nil), // 3: slinky.marketmap.v1.MsgParams - (*MsgParamsResponse)(nil), // 4: slinky.marketmap.v1.MsgParamsResponse - (*Ticker)(nil), // 5: slinky.marketmap.v1.Ticker - (*Providers)(nil), // 6: slinky.marketmap.v1.Providers - (*Paths)(nil), // 7: slinky.marketmap.v1.Paths - (*Params)(nil), // 8: slinky.marketmap.v1.Params + (*MsgCreateMarkets)(nil), // 0: slinky.marketmap.v1.MsgCreateMarkets + (*MsgCreateMarketsResponse)(nil), // 1: slinky.marketmap.v1.MsgCreateMarketsResponse + (*MsgUpdateMarkets)(nil), // 2: slinky.marketmap.v1.MsgUpdateMarkets + (*MsgUpdateMarketsResponse)(nil), // 3: slinky.marketmap.v1.MsgUpdateMarketsResponse + (*MsgParams)(nil), // 4: slinky.marketmap.v1.MsgParams + (*MsgParamsResponse)(nil), // 5: slinky.marketmap.v1.MsgParamsResponse + (*MsgRemoveMarketAuthorities)(nil), // 6: slinky.marketmap.v1.MsgRemoveMarketAuthorities + (*MsgRemoveMarketAuthoritiesResponse)(nil), // 7: slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse + (*Market)(nil), // 8: slinky.marketmap.v1.Market + (*Params)(nil), // 9: slinky.marketmap.v1.Params } var file_slinky_marketmap_v1_tx_proto_depIdxs = []int32{ - 5, // 0: slinky.marketmap.v1.CreateMarket.ticker:type_name -> slinky.marketmap.v1.Ticker - 6, // 1: slinky.marketmap.v1.CreateMarket.providers:type_name -> slinky.marketmap.v1.Providers - 7, // 2: slinky.marketmap.v1.CreateMarket.paths:type_name -> slinky.marketmap.v1.Paths - 0, // 3: slinky.marketmap.v1.MsgUpdateMarketMap.create_markets:type_name -> slinky.marketmap.v1.CreateMarket - 8, // 4: slinky.marketmap.v1.MsgParams.params:type_name -> slinky.marketmap.v1.Params - 1, // 5: slinky.marketmap.v1.Msg.UpdateMarketMap:input_type -> slinky.marketmap.v1.MsgUpdateMarketMap - 3, // 6: slinky.marketmap.v1.Msg.Params:input_type -> slinky.marketmap.v1.MsgParams - 2, // 7: slinky.marketmap.v1.Msg.UpdateMarketMap:output_type -> slinky.marketmap.v1.MsgUpdateMarketMapResponse - 4, // 8: slinky.marketmap.v1.Msg.Params:output_type -> slinky.marketmap.v1.MsgParamsResponse - 7, // [7:9] is the sub-list for method output_type - 5, // [5:7] is the sub-list for method input_type - 5, // [5:5] is the sub-list for extension type_name - 5, // [5:5] is the sub-list for extension extendee - 0, // [0:5] is the sub-list for field type_name + 8, // 0: slinky.marketmap.v1.MsgCreateMarkets.create_markets:type_name -> slinky.marketmap.v1.Market + 8, // 1: slinky.marketmap.v1.MsgUpdateMarkets.update_markets:type_name -> slinky.marketmap.v1.Market + 9, // 2: slinky.marketmap.v1.MsgParams.params:type_name -> slinky.marketmap.v1.Params + 0, // 3: slinky.marketmap.v1.Msg.CreateMarkets:input_type -> slinky.marketmap.v1.MsgCreateMarkets + 2, // 4: slinky.marketmap.v1.Msg.UpdateMarkets:input_type -> slinky.marketmap.v1.MsgUpdateMarkets + 4, // 5: slinky.marketmap.v1.Msg.Params:input_type -> slinky.marketmap.v1.MsgParams + 6, // 6: slinky.marketmap.v1.Msg.RemoveMarketAuthorities:input_type -> slinky.marketmap.v1.MsgRemoveMarketAuthorities + 1, // 7: slinky.marketmap.v1.Msg.CreateMarkets:output_type -> slinky.marketmap.v1.MsgCreateMarketsResponse + 3, // 8: slinky.marketmap.v1.Msg.UpdateMarkets:output_type -> slinky.marketmap.v1.MsgUpdateMarketsResponse + 5, // 9: slinky.marketmap.v1.Msg.Params:output_type -> slinky.marketmap.v1.MsgParamsResponse + 7, // 10: slinky.marketmap.v1.Msg.RemoveMarketAuthorities:output_type -> slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse + 7, // [7:11] is the sub-list for method output_type + 3, // [3:7] 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_slinky_marketmap_v1_tx_proto_init() } @@ -2731,7 +4079,7 @@ func file_slinky_marketmap_v1_tx_proto_init() { file_slinky_marketmap_v1_params_proto_init() if !protoimpl.UnsafeEnabled { file_slinky_marketmap_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*CreateMarket); i { + switch v := v.(*MsgCreateMarkets); i { case 0: return &v.state case 1: @@ -2743,7 +4091,7 @@ func file_slinky_marketmap_v1_tx_proto_init() { } } file_slinky_marketmap_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateMarketMap); i { + switch v := v.(*MsgCreateMarketsResponse); i { case 0: return &v.state case 1: @@ -2755,7 +4103,7 @@ func file_slinky_marketmap_v1_tx_proto_init() { } } file_slinky_marketmap_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateMarketMapResponse); i { + switch v := v.(*MsgUpdateMarkets); i { case 0: return &v.state case 1: @@ -2767,7 +4115,7 @@ func file_slinky_marketmap_v1_tx_proto_init() { } } file_slinky_marketmap_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgParams); i { + switch v := v.(*MsgUpdateMarketsResponse); i { case 0: return &v.state case 1: @@ -2779,6 +4127,18 @@ func file_slinky_marketmap_v1_tx_proto_init() { } } file_slinky_marketmap_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_slinky_marketmap_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MsgParamsResponse); i { case 0: return &v.state @@ -2790,6 +4150,30 @@ func file_slinky_marketmap_v1_tx_proto_init() { return nil } } + file_slinky_marketmap_v1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRemoveMarketAuthorities); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_slinky_marketmap_v1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*MsgRemoveMarketAuthoritiesResponse); 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{ @@ -2797,7 +4181,7 @@ func file_slinky_marketmap_v1_tx_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_slinky_marketmap_v1_tx_proto_rawDesc, NumEnums: 0, - NumMessages: 5, + NumMessages: 8, NumExtensions: 0, NumServices: 1, }, diff --git a/api/slinky/marketmap/v1/tx_grpc.pb.go b/api/slinky/marketmap/v1/tx_grpc.pb.go index 7012d5030..94e0fb0d9 100644 --- a/api/slinky/marketmap/v1/tx_grpc.pb.go +++ b/api/slinky/marketmap/v1/tx_grpc.pb.go @@ -19,18 +19,25 @@ import ( const _ = grpc.SupportPackageIsVersion7 const ( - Msg_UpdateMarketMap_FullMethodName = "/slinky.marketmap.v1.Msg/UpdateMarketMap" - Msg_Params_FullMethodName = "/slinky.marketmap.v1.Msg/Params" + Msg_CreateMarkets_FullMethodName = "/slinky.marketmap.v1.Msg/CreateMarkets" + Msg_UpdateMarkets_FullMethodName = "/slinky.marketmap.v1.Msg/UpdateMarkets" + Msg_Params_FullMethodName = "/slinky.marketmap.v1.Msg/Params" + Msg_RemoveMarketAuthorities_FullMethodName = "/slinky.marketmap.v1.Msg/RemoveMarketAuthorities" ) // MsgClient is the client API for Msg service. // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. type MsgClient interface { - // UpdateMarketMap creates markets from the given message. - UpdateMarketMap(ctx context.Context, in *MsgUpdateMarketMap, opts ...grpc.CallOption) (*MsgUpdateMarketMapResponse, error) + // CreateMarkets creates markets from the given message. + CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) + // UpdateMarkets updates markets from the given message. + UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) // Params defines a method for updating the x/marketmap module parameters. Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) + // RemoveMarketAuthorities defines a method for removing market authorities + // from the x/marketmap module. the signer must be the admin. + RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) } type msgClient struct { @@ -41,9 +48,18 @@ func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateMarketMap(ctx context.Context, in *MsgUpdateMarketMap, opts ...grpc.CallOption) (*MsgUpdateMarketMapResponse, error) { - out := new(MsgUpdateMarketMapResponse) - err := c.cc.Invoke(ctx, Msg_UpdateMarketMap_FullMethodName, in, out, opts...) +func (c *msgClient) CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) { + out := new(MsgCreateMarketsResponse) + err := c.cc.Invoke(ctx, Msg_CreateMarkets_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) { + out := new(MsgUpdateMarketsResponse) + err := c.cc.Invoke(ctx, Msg_UpdateMarkets_FullMethodName, in, out, opts...) if err != nil { return nil, err } @@ -59,14 +75,28 @@ func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.Call return out, nil } +func (c *msgClient) RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) { + out := new(MsgRemoveMarketAuthoritiesResponse) + err := c.cc.Invoke(ctx, Msg_RemoveMarketAuthorities_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 type MsgServer interface { - // UpdateMarketMap creates markets from the given message. - UpdateMarketMap(context.Context, *MsgUpdateMarketMap) (*MsgUpdateMarketMapResponse, error) + // CreateMarkets creates markets from the given message. + CreateMarkets(context.Context, *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) + // UpdateMarkets updates markets from the given message. + UpdateMarkets(context.Context, *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) // Params defines a method for updating the x/marketmap module parameters. Params(context.Context, *MsgParams) (*MsgParamsResponse, error) + // RemoveMarketAuthorities defines a method for removing market authorities + // from the x/marketmap module. the signer must be the admin. + RemoveMarketAuthorities(context.Context, *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) mustEmbedUnimplementedMsgServer() } @@ -74,12 +104,18 @@ type MsgServer interface { type UnimplementedMsgServer struct { } -func (UnimplementedMsgServer) UpdateMarketMap(context.Context, *MsgUpdateMarketMap) (*MsgUpdateMarketMapResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateMarketMap not implemented") +func (UnimplementedMsgServer) CreateMarkets(context.Context, *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateMarkets not implemented") +} +func (UnimplementedMsgServer) UpdateMarkets(context.Context, *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMarkets not implemented") } func (UnimplementedMsgServer) Params(context.Context, *MsgParams) (*MsgParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (UnimplementedMsgServer) RemoveMarketAuthorities(context.Context, *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveMarketAuthorities not implemented") +} func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} // UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. @@ -93,20 +129,38 @@ func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { s.RegisterService(&Msg_ServiceDesc, srv) } -func _Msg_UpdateMarketMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateMarketMap) +func _Msg_CreateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateMarkets) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateMarkets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_CreateMarkets_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateMarkets(ctx, req.(*MsgCreateMarkets)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMarkets) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateMarketMap(ctx, in) + return srv.(MsgServer).UpdateMarkets(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: Msg_UpdateMarketMap_FullMethodName, + FullMethod: Msg_UpdateMarkets_FullMethodName, } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateMarketMap(ctx, req.(*MsgUpdateMarketMap)) + return srv.(MsgServer).UpdateMarkets(ctx, req.(*MsgUpdateMarkets)) } return interceptor(ctx, in, info, handler) } @@ -129,6 +183,24 @@ func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_RemoveMarketAuthorities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveMarketAuthorities) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveMarketAuthorities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: Msg_RemoveMarketAuthorities_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveMarketAuthorities(ctx, req.(*MsgRemoveMarketAuthorities)) + } + 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) @@ -137,13 +209,21 @@ var Msg_ServiceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UpdateMarketMap", - Handler: _Msg_UpdateMarketMap_Handler, + MethodName: "CreateMarkets", + Handler: _Msg_CreateMarkets_Handler, + }, + { + MethodName: "UpdateMarkets", + Handler: _Msg_UpdateMarkets_Handler, }, { MethodName: "Params", Handler: _Msg_Params_Handler, }, + { + MethodName: "RemoveMarketAuthorities", + Handler: _Msg_RemoveMarketAuthorities_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "slinky/marketmap/v1/tx.proto", diff --git a/api/slinky/mm2/module/v1/module.pulsar.go b/api/slinky/mm2/module/v1/module.pulsar.go deleted file mode 100644 index 7c8db0ae6..000000000 --- a/api/slinky/mm2/module/v1/module.pulsar.go +++ /dev/null @@ -1,715 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package modulev1 - -import ( - _ "cosmossdk.io/api/cosmos/app/v1alpha1" - 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 _ protoreflect.List = (*_Module_2_list)(nil) - -type _Module_2_list struct { - list *[]string -} - -func (x *_Module_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Module_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_Module_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_Module_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_Module_2_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message Module at list field HooksOrder as it is not of Message kind")) -} - -func (x *_Module_2_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_Module_2_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_Module_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_Module protoreflect.MessageDescriptor - fd_Module_authority protoreflect.FieldDescriptor - fd_Module_hooks_order protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_module_v1_module_proto_init() - md_Module = File_slinky_mm2_module_v1_module_proto.Messages().ByName("Module") - fd_Module_authority = md_Module.Fields().ByName("authority") - fd_Module_hooks_order = md_Module.Fields().ByName("hooks_order") -} - -var _ protoreflect.Message = (*fastReflection_Module)(nil) - -type fastReflection_Module Module - -func (x *Module) ProtoReflect() protoreflect.Message { - return (*fastReflection_Module)(x) -} - -func (x *Module) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_module_v1_module_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_Module_messageType fastReflection_Module_messageType -var _ protoreflect.MessageType = fastReflection_Module_messageType{} - -type fastReflection_Module_messageType struct{} - -func (x fastReflection_Module_messageType) Zero() protoreflect.Message { - return (*fastReflection_Module)(nil) -} -func (x fastReflection_Module_messageType) New() protoreflect.Message { - return new(fastReflection_Module) -} -func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor { - return md_Module -} - -// 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_Module) Type() protoreflect.MessageType { - return _fastReflection_Module_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Module) New() protoreflect.Message { - return new(fastReflection_Module) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage { - return (*Module)(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_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_Module_authority, value) { - return - } - } - if len(x.HooksOrder) != 0 { - value := protoreflect.ValueOfList(&_Module_2_list{list: &x.HooksOrder}) - if !f(fd_Module_hooks_order, 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_Module) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.module.v1.Module.authority": - return x.Authority != "" - case "slinky.mm2.module.v1.Module.hooks_order": - return len(x.HooksOrder) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.mm2.module.v1.Module 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_Module) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.module.v1.Module.authority": - x.Authority = "" - case "slinky.mm2.module.v1.Module.hooks_order": - x.HooksOrder = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.mm2.module.v1.Module 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_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.module.v1.Module.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - case "slinky.mm2.module.v1.Module.hooks_order": - if len(x.HooksOrder) == 0 { - return protoreflect.ValueOfList(&_Module_2_list{}) - } - listValue := &_Module_2_list{list: &x.HooksOrder} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.mm2.module.v1.Module 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_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.module.v1.Module.authority": - x.Authority = value.Interface().(string) - case "slinky.mm2.module.v1.Module.hooks_order": - lv := value.List() - clv := lv.(*_Module_2_list) - x.HooksOrder = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.mm2.module.v1.Module 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_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.module.v1.Module.hooks_order": - if x.HooksOrder == nil { - x.HooksOrder = []string{} - } - value := &_Module_2_list{list: &x.HooksOrder} - return protoreflect.ValueOfList(value) - case "slinky.mm2.module.v1.Module.authority": - panic(fmt.Errorf("field authority of message slinky.mm2.module.v1.Module is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.mm2.module.v1.Module 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_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.module.v1.Module.authority": - return protoreflect.ValueOfString("") - case "slinky.mm2.module.v1.Module.hooks_order": - list := []string{} - return protoreflect.ValueOfList(&_Module_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.module.v1.Module")) - } - panic(fmt.Errorf("message slinky.mm2.module.v1.Module 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_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.module.v1.Module", 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_Module) 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_Module) 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_Module) 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_Module) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Module) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.HooksOrder) > 0 { - for _, s := range x.HooksOrder { - l = len(s) - 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().(*Module) - 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.HooksOrder) > 0 { - for iNdEx := len(x.HooksOrder) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.HooksOrder[iNdEx]) - copy(dAtA[i:], x.HooksOrder[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.HooksOrder[iNdEx]))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Module) - 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: Module: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field HooksOrder", 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.HooksOrder = append(x.HooksOrder, 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: slinky/mm2/module/v1/module.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) -) - -// Module is the config object of the builder module. -type Module struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Authority defines the custom module authority. If not set, defaults to the - // governance module. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // HooksOrder specifies the order of marketmap hooks and should be a list - // of module names which provide a marketmap hooks instance. If no order is - // provided, then hooks will be applied in alphabetical order of module names. - HooksOrder []string `protobuf:"bytes,2,rep,name=hooks_order,json=hooksOrder,proto3" json:"hooks_order,omitempty"` -} - -func (x *Module) Reset() { - *x = Module{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_module_v1_module_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Module) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Module) ProtoMessage() {} - -// Deprecated: Use Module.ProtoReflect.Descriptor instead. -func (*Module) Descriptor() ([]byte, []int) { - return file_slinky_mm2_module_v1_module_proto_rawDescGZIP(), []int{0} -} - -func (x *Module) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *Module) GetHooksOrder() []string { - if x != nil { - return x.HooksOrder - } - return nil -} - -var File_slinky_mm2_module_v1_module_proto protoreflect.FileDescriptor - -var file_slinky_mm2_module_v1_module_proto_rawDesc = []byte{ - 0x0a, 0x21, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x6d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x12, 0x14, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, - 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x71, 0x0a, 0x06, 0x4d, - 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, - 0x69, 0x74, 0x79, 0x12, 0x1f, 0x0a, 0x0b, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x5f, 0x6f, 0x72, 0x64, - 0x65, 0x72, 0x18, 0x02, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x68, 0x6f, 0x6f, 0x6b, 0x73, 0x4f, - 0x72, 0x64, 0x65, 0x72, 0x3a, 0x28, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x22, 0x0a, 0x20, 0x67, 0x69, - 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x6b, 0x69, 0x70, 0x2d, 0x6d, 0x65, - 0x76, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x6d, 0x6d, 0x32, 0x42, 0xca, - 0x01, 0x0a, 0x18, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, - 0x32, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, - 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x2e, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2f, 0x76, - 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x4d, - 0xaa, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x6d, 0x32, 0x2e, 0x4d, 0x6f, - 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x14, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31, 0xe2, 0x02, - 0x20, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x4d, 0x6f, 0x64, 0x75, - 0x6c, 0x65, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, - 0x61, 0xea, 0x02, 0x17, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x6d, 0x32, 0x3a, - 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_mm2_module_v1_module_proto_rawDescOnce sync.Once - file_slinky_mm2_module_v1_module_proto_rawDescData = file_slinky_mm2_module_v1_module_proto_rawDesc -) - -func file_slinky_mm2_module_v1_module_proto_rawDescGZIP() []byte { - file_slinky_mm2_module_v1_module_proto_rawDescOnce.Do(func() { - file_slinky_mm2_module_v1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_mm2_module_v1_module_proto_rawDescData) - }) - return file_slinky_mm2_module_v1_module_proto_rawDescData -} - -var file_slinky_mm2_module_v1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_mm2_module_v1_module_proto_goTypes = []interface{}{ - (*Module)(nil), // 0: slinky.mm2.module.v1.Module -} -var file_slinky_mm2_module_v1_module_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_slinky_mm2_module_v1_module_proto_init() } -func file_slinky_mm2_module_v1_module_proto_init() { - if File_slinky_mm2_module_v1_module_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_mm2_module_v1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Module); 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_slinky_mm2_module_v1_module_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_mm2_module_v1_module_proto_goTypes, - DependencyIndexes: file_slinky_mm2_module_v1_module_proto_depIdxs, - MessageInfos: file_slinky_mm2_module_v1_module_proto_msgTypes, - }.Build() - File_slinky_mm2_module_v1_module_proto = out.File - file_slinky_mm2_module_v1_module_proto_rawDesc = nil - file_slinky_mm2_module_v1_module_proto_goTypes = nil - file_slinky_mm2_module_v1_module_proto_depIdxs = nil -} diff --git a/api/slinky/mm2/v1/genesis.pulsar.go b/api/slinky/mm2/v1/genesis.pulsar.go deleted file mode 100644 index 8a9dfabf7..000000000 --- a/api/slinky/mm2/v1/genesis.pulsar.go +++ /dev/null @@ -1,750 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package mm2v1 - -import ( - fmt "fmt" - 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 ( - md_GenesisState protoreflect.MessageDescriptor - fd_GenesisState_market_map protoreflect.FieldDescriptor - fd_GenesisState_last_updated protoreflect.FieldDescriptor - fd_GenesisState_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_genesis_proto_init() - md_GenesisState = File_slinky_mm2_v1_genesis_proto.Messages().ByName("GenesisState") - fd_GenesisState_market_map = md_GenesisState.Fields().ByName("market_map") - fd_GenesisState_last_updated = md_GenesisState.Fields().ByName("last_updated") - fd_GenesisState_params = md_GenesisState.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_GenesisState)(nil) - -type fastReflection_GenesisState GenesisState - -func (x *GenesisState) ProtoReflect() protoreflect.Message { - return (*fastReflection_GenesisState)(x) -} - -func (x *GenesisState) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_genesis_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_GenesisState_messageType fastReflection_GenesisState_messageType -var _ protoreflect.MessageType = fastReflection_GenesisState_messageType{} - -type fastReflection_GenesisState_messageType struct{} - -func (x fastReflection_GenesisState_messageType) Zero() protoreflect.Message { - return (*fastReflection_GenesisState)(nil) -} -func (x fastReflection_GenesisState_messageType) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} -func (x fastReflection_GenesisState_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_GenesisState) Descriptor() protoreflect.MessageDescriptor { - return md_GenesisState -} - -// 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_GenesisState) Type() protoreflect.MessageType { - return _fastReflection_GenesisState_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_GenesisState) New() protoreflect.Message { - return new(fastReflection_GenesisState) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_GenesisState) Interface() protoreflect.ProtoMessage { - return (*GenesisState)(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_GenesisState) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.MarketMap != nil { - value := protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) - if !f(fd_GenesisState_market_map, value) { - return - } - } - if x.LastUpdated != uint64(0) { - value := protoreflect.ValueOfUint64(x.LastUpdated) - if !f(fd_GenesisState_last_updated, value) { - return - } - } - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_GenesisState_params, 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_GenesisState) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.GenesisState.market_map": - return x.MarketMap != nil - case "slinky.mm2.v1.GenesisState.last_updated": - return x.LastUpdated != uint64(0) - case "slinky.mm2.v1.GenesisState.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.mm2.v1.GenesisState 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_GenesisState) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.GenesisState.market_map": - x.MarketMap = nil - case "slinky.mm2.v1.GenesisState.last_updated": - x.LastUpdated = uint64(0) - case "slinky.mm2.v1.GenesisState.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.mm2.v1.GenesisState 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_GenesisState) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.GenesisState.market_map": - value := x.MarketMap - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.mm2.v1.GenesisState.last_updated": - value := x.LastUpdated - return protoreflect.ValueOfUint64(value) - case "slinky.mm2.v1.GenesisState.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.mm2.v1.GenesisState 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_GenesisState) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.GenesisState.market_map": - x.MarketMap = value.Message().Interface().(*MarketMap) - case "slinky.mm2.v1.GenesisState.last_updated": - x.LastUpdated = value.Uint() - case "slinky.mm2.v1.GenesisState.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.mm2.v1.GenesisState 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_GenesisState) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.GenesisState.market_map": - if x.MarketMap == nil { - x.MarketMap = new(MarketMap) - } - return protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) - case "slinky.mm2.v1.GenesisState.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "slinky.mm2.v1.GenesisState.last_updated": - panic(fmt.Errorf("field last_updated of message slinky.mm2.v1.GenesisState is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.mm2.v1.GenesisState 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_GenesisState) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.GenesisState.market_map": - m := new(MarketMap) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.mm2.v1.GenesisState.last_updated": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.mm2.v1.GenesisState.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.GenesisState")) - } - panic(fmt.Errorf("message slinky.mm2.v1.GenesisState 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_GenesisState) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.GenesisState", 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_GenesisState) 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_GenesisState) 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_GenesisState) 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_GenesisState) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*GenesisState) - 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.MarketMap != nil { - l = options.Size(x.MarketMap) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.LastUpdated != 0 { - n += 1 + runtime.Sov(uint64(x.LastUpdated)) - } - if x.Params != nil { - l = options.Size(x.Params) - 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().(*GenesisState) - 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.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if x.LastUpdated != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.LastUpdated)) - i-- - dAtA[i] = 0x10 - } - if x.MarketMap != nil { - encoded, err := options.Marshal(x.MarketMap) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*GenesisState) - 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: GenesisState: 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 MarketMap", 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.MarketMap == nil { - x.MarketMap = &MarketMap{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MarketMap); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - x.LastUpdated = 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.LastUpdated |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Params", 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.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/mm2/v1/genesis.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) -) - -// GenesisState defines the x/marketmap module's genesis state. -type GenesisState struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // MarketMap defines the global set of market configurations for all providers - // and markets. - MarketMap *MarketMap `protobuf:"bytes,1,opt,name=market_map,json=marketMap,proto3" json:"market_map,omitempty"` - // LastUpdated is the last block height that the market map was updated. - // This field can be used as an optimization for clients checking if there - // is a new update to the map. - LastUpdated uint64 `protobuf:"varint,2,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - // Params are the parameters for the x/marketmap module. - Params *Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *GenesisState) Reset() { - *x = GenesisState{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_genesis_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *GenesisState) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*GenesisState) ProtoMessage() {} - -// Deprecated: Use GenesisState.ProtoReflect.Descriptor instead. -func (*GenesisState) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_genesis_proto_rawDescGZIP(), []int{0} -} - -func (x *GenesisState) GetMarketMap() *MarketMap { - if x != nil { - return x.MarketMap - } - return nil -} - -func (x *GenesisState) GetLastUpdated() uint64 { - if x != nil { - return x.LastUpdated - } - return 0 -} - -func (x *GenesisState) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -var File_slinky_mm2_v1_genesis_proto protoreflect.FileDescriptor - -var file_slinky_mm2_v1_genesis_proto_rawDesc = []byte{ - 0x0a, 0x1b, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, - 0x67, 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, - 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x1a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, - 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1a, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa5, 0x01, 0x0a, 0x0c, 0x47, - 0x65, 0x6e, 0x65, 0x73, 0x69, 0x73, 0x53, 0x74, 0x61, 0x74, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x09, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, - 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, - 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x33, 0x0a, - 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x42, 0x9d, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x42, 0x0c, 0x47, 0x65, 0x6e, 0x65, 0x73, 0x69, - 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6d, 0x32, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x6d, - 0x32, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, - 0x32, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, - 0x32, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x6d, 0x32, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_mm2_v1_genesis_proto_rawDescOnce sync.Once - file_slinky_mm2_v1_genesis_proto_rawDescData = file_slinky_mm2_v1_genesis_proto_rawDesc -) - -func file_slinky_mm2_v1_genesis_proto_rawDescGZIP() []byte { - file_slinky_mm2_v1_genesis_proto_rawDescOnce.Do(func() { - file_slinky_mm2_v1_genesis_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_mm2_v1_genesis_proto_rawDescData) - }) - return file_slinky_mm2_v1_genesis_proto_rawDescData -} - -var file_slinky_mm2_v1_genesis_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_mm2_v1_genesis_proto_goTypes = []interface{}{ - (*GenesisState)(nil), // 0: slinky.mm2.v1.GenesisState - (*MarketMap)(nil), // 1: slinky.mm2.v1.MarketMap - (*Params)(nil), // 2: slinky.mm2.v1.Params -} -var file_slinky_mm2_v1_genesis_proto_depIdxs = []int32{ - 1, // 0: slinky.mm2.v1.GenesisState.market_map:type_name -> slinky.mm2.v1.MarketMap - 2, // 1: slinky.mm2.v1.GenesisState.params:type_name -> slinky.mm2.v1.Params - 2, // [2:2] is the sub-list for method output_type - 2, // [2:2] is the sub-list for method input_type - 2, // [2:2] is the sub-list for extension type_name - 2, // [2:2] is the sub-list for extension extendee - 0, // [0:2] is the sub-list for field type_name -} - -func init() { file_slinky_mm2_v1_genesis_proto_init() } -func file_slinky_mm2_v1_genesis_proto_init() { - if File_slinky_mm2_v1_genesis_proto != nil { - return - } - file_slinky_mm2_v1_market_proto_init() - file_slinky_mm2_v1_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_mm2_v1_genesis_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*GenesisState); 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_slinky_mm2_v1_genesis_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_mm2_v1_genesis_proto_goTypes, - DependencyIndexes: file_slinky_mm2_v1_genesis_proto_depIdxs, - MessageInfos: file_slinky_mm2_v1_genesis_proto_msgTypes, - }.Build() - File_slinky_mm2_v1_genesis_proto = out.File - file_slinky_mm2_v1_genesis_proto_rawDesc = nil - file_slinky_mm2_v1_genesis_proto_goTypes = nil - file_slinky_mm2_v1_genesis_proto_depIdxs = nil -} diff --git a/api/slinky/mm2/v1/market.pulsar.go b/api/slinky/mm2/v1/market.pulsar.go deleted file mode 100644 index fcb509df6..000000000 --- a/api/slinky/mm2/v1/market.pulsar.go +++ /dev/null @@ -1,3040 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package mm2v1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - v1 "github.com/skip-mev/slinky/api/slinky/types/v1" - 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" - sort "sort" - sync "sync" -) - -var _ protoreflect.List = (*_Market_2_list)(nil) - -type _Market_2_list struct { - list *[]*ProviderConfig -} - -func (x *_Market_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Market_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_Market_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*ProviderConfig) - (*x.list)[i] = concreteValue -} - -func (x *_Market_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*ProviderConfig) - *x.list = append(*x.list, concreteValue) -} - -func (x *_Market_2_list) AppendMutable() protoreflect.Value { - v := new(ProviderConfig) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Market_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_Market_2_list) NewElement() protoreflect.Value { - v := new(ProviderConfig) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_Market_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_Market protoreflect.MessageDescriptor - fd_Market_ticker protoreflect.FieldDescriptor - fd_Market_provider_configs protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_market_proto_init() - md_Market = File_slinky_mm2_v1_market_proto.Messages().ByName("Market") - fd_Market_ticker = md_Market.Fields().ByName("ticker") - fd_Market_provider_configs = md_Market.Fields().ByName("provider_configs") -} - -var _ protoreflect.Message = (*fastReflection_Market)(nil) - -type fastReflection_Market Market - -func (x *Market) ProtoReflect() protoreflect.Message { - return (*fastReflection_Market)(x) -} - -func (x *Market) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_market_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_Market_messageType fastReflection_Market_messageType -var _ protoreflect.MessageType = fastReflection_Market_messageType{} - -type fastReflection_Market_messageType struct{} - -func (x fastReflection_Market_messageType) Zero() protoreflect.Message { - return (*fastReflection_Market)(nil) -} -func (x fastReflection_Market_messageType) New() protoreflect.Message { - return new(fastReflection_Market) -} -func (x fastReflection_Market_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Market -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Market) Descriptor() protoreflect.MessageDescriptor { - return md_Market -} - -// 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_Market) Type() protoreflect.MessageType { - return _fastReflection_Market_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Market) New() protoreflect.Message { - return new(fastReflection_Market) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Market) Interface() protoreflect.ProtoMessage { - return (*Market)(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_Market) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Ticker != nil { - value := protoreflect.ValueOfMessage(x.Ticker.ProtoReflect()) - if !f(fd_Market_ticker, value) { - return - } - } - if len(x.ProviderConfigs) != 0 { - value := protoreflect.ValueOfList(&_Market_2_list{list: &x.ProviderConfigs}) - if !f(fd_Market_provider_configs, 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_Market) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.Market.ticker": - return x.Ticker != nil - case "slinky.mm2.v1.Market.provider_configs": - return len(x.ProviderConfigs) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Market")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Market 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_Market) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.Market.ticker": - x.Ticker = nil - case "slinky.mm2.v1.Market.provider_configs": - x.ProviderConfigs = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Market")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Market 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_Market) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.Market.ticker": - value := x.Ticker - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.mm2.v1.Market.provider_configs": - if len(x.ProviderConfigs) == 0 { - return protoreflect.ValueOfList(&_Market_2_list{}) - } - listValue := &_Market_2_list{list: &x.ProviderConfigs} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Market")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Market 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_Market) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.Market.ticker": - x.Ticker = value.Message().Interface().(*Ticker) - case "slinky.mm2.v1.Market.provider_configs": - lv := value.List() - clv := lv.(*_Market_2_list) - x.ProviderConfigs = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Market")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Market 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_Market) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.Market.ticker": - if x.Ticker == nil { - x.Ticker = new(Ticker) - } - return protoreflect.ValueOfMessage(x.Ticker.ProtoReflect()) - case "slinky.mm2.v1.Market.provider_configs": - if x.ProviderConfigs == nil { - x.ProviderConfigs = []*ProviderConfig{} - } - value := &_Market_2_list{list: &x.ProviderConfigs} - return protoreflect.ValueOfList(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Market")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Market 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_Market) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.Market.ticker": - m := new(Ticker) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.mm2.v1.Market.provider_configs": - list := []*ProviderConfig{} - return protoreflect.ValueOfList(&_Market_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Market")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Market 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_Market) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.Market", 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_Market) 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_Market) 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_Market) 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_Market) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Market) - 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.Ticker != nil { - l = options.Size(x.Ticker) - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.ProviderConfigs) > 0 { - for _, e := range x.ProviderConfigs { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Market) - 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.ProviderConfigs) > 0 { - for iNdEx := len(x.ProviderConfigs) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.ProviderConfigs[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if x.Ticker != nil { - encoded, err := options.Marshal(x.Ticker) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Market) - 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: Market: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Market: 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 Ticker", 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.Ticker == nil { - x.Ticker = &Ticker{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Ticker); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ProviderConfigs", 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.ProviderConfigs = append(x.ProviderConfigs, &ProviderConfig{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.ProviderConfigs[len(x.ProviderConfigs)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_Ticker protoreflect.MessageDescriptor - fd_Ticker_currency_pair protoreflect.FieldDescriptor - fd_Ticker_decimals protoreflect.FieldDescriptor - fd_Ticker_min_provider_count protoreflect.FieldDescriptor - fd_Ticker_enabled protoreflect.FieldDescriptor - fd_Ticker_metadata_JSON protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_market_proto_init() - md_Ticker = File_slinky_mm2_v1_market_proto.Messages().ByName("Ticker") - fd_Ticker_currency_pair = md_Ticker.Fields().ByName("currency_pair") - fd_Ticker_decimals = md_Ticker.Fields().ByName("decimals") - fd_Ticker_min_provider_count = md_Ticker.Fields().ByName("min_provider_count") - fd_Ticker_enabled = md_Ticker.Fields().ByName("enabled") - fd_Ticker_metadata_JSON = md_Ticker.Fields().ByName("metadata_JSON") -} - -var _ protoreflect.Message = (*fastReflection_Ticker)(nil) - -type fastReflection_Ticker Ticker - -func (x *Ticker) ProtoReflect() protoreflect.Message { - return (*fastReflection_Ticker)(x) -} - -func (x *Ticker) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_market_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_Ticker_messageType fastReflection_Ticker_messageType -var _ protoreflect.MessageType = fastReflection_Ticker_messageType{} - -type fastReflection_Ticker_messageType struct{} - -func (x fastReflection_Ticker_messageType) Zero() protoreflect.Message { - return (*fastReflection_Ticker)(nil) -} -func (x fastReflection_Ticker_messageType) New() protoreflect.Message { - return new(fastReflection_Ticker) -} -func (x fastReflection_Ticker_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Ticker -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Ticker) Descriptor() protoreflect.MessageDescriptor { - return md_Ticker -} - -// 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_Ticker) Type() protoreflect.MessageType { - return _fastReflection_Ticker_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Ticker) New() protoreflect.Message { - return new(fastReflection_Ticker) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Ticker) Interface() protoreflect.ProtoMessage { - return (*Ticker)(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_Ticker) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.CurrencyPair != nil { - value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - if !f(fd_Ticker_currency_pair, value) { - return - } - } - if x.Decimals != uint64(0) { - value := protoreflect.ValueOfUint64(x.Decimals) - if !f(fd_Ticker_decimals, value) { - return - } - } - if x.MinProviderCount != uint64(0) { - value := protoreflect.ValueOfUint64(x.MinProviderCount) - if !f(fd_Ticker_min_provider_count, value) { - return - } - } - if x.Enabled != false { - value := protoreflect.ValueOfBool(x.Enabled) - if !f(fd_Ticker_enabled, value) { - return - } - } - if x.Metadata_JSON != "" { - value := protoreflect.ValueOfString(x.Metadata_JSON) - if !f(fd_Ticker_metadata_JSON, 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_Ticker) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.Ticker.currency_pair": - return x.CurrencyPair != nil - case "slinky.mm2.v1.Ticker.decimals": - return x.Decimals != uint64(0) - case "slinky.mm2.v1.Ticker.min_provider_count": - return x.MinProviderCount != uint64(0) - case "slinky.mm2.v1.Ticker.enabled": - return x.Enabled != false - case "slinky.mm2.v1.Ticker.metadata_JSON": - return x.Metadata_JSON != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Ticker")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Ticker 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_Ticker) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.Ticker.currency_pair": - x.CurrencyPair = nil - case "slinky.mm2.v1.Ticker.decimals": - x.Decimals = uint64(0) - case "slinky.mm2.v1.Ticker.min_provider_count": - x.MinProviderCount = uint64(0) - case "slinky.mm2.v1.Ticker.enabled": - x.Enabled = false - case "slinky.mm2.v1.Ticker.metadata_JSON": - x.Metadata_JSON = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Ticker")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Ticker 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_Ticker) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.Ticker.currency_pair": - value := x.CurrencyPair - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.mm2.v1.Ticker.decimals": - value := x.Decimals - return protoreflect.ValueOfUint64(value) - case "slinky.mm2.v1.Ticker.min_provider_count": - value := x.MinProviderCount - return protoreflect.ValueOfUint64(value) - case "slinky.mm2.v1.Ticker.enabled": - value := x.Enabled - return protoreflect.ValueOfBool(value) - case "slinky.mm2.v1.Ticker.metadata_JSON": - value := x.Metadata_JSON - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Ticker")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Ticker 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_Ticker) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.Ticker.currency_pair": - x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) - case "slinky.mm2.v1.Ticker.decimals": - x.Decimals = value.Uint() - case "slinky.mm2.v1.Ticker.min_provider_count": - x.MinProviderCount = value.Uint() - case "slinky.mm2.v1.Ticker.enabled": - x.Enabled = value.Bool() - case "slinky.mm2.v1.Ticker.metadata_JSON": - x.Metadata_JSON = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Ticker")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Ticker 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_Ticker) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.Ticker.currency_pair": - if x.CurrencyPair == nil { - x.CurrencyPair = new(v1.CurrencyPair) - } - return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - case "slinky.mm2.v1.Ticker.decimals": - panic(fmt.Errorf("field decimals of message slinky.mm2.v1.Ticker is not mutable")) - case "slinky.mm2.v1.Ticker.min_provider_count": - panic(fmt.Errorf("field min_provider_count of message slinky.mm2.v1.Ticker is not mutable")) - case "slinky.mm2.v1.Ticker.enabled": - panic(fmt.Errorf("field enabled of message slinky.mm2.v1.Ticker is not mutable")) - case "slinky.mm2.v1.Ticker.metadata_JSON": - panic(fmt.Errorf("field metadata_JSON of message slinky.mm2.v1.Ticker is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Ticker")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Ticker 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_Ticker) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.Ticker.currency_pair": - m := new(v1.CurrencyPair) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.mm2.v1.Ticker.decimals": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.mm2.v1.Ticker.min_provider_count": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.mm2.v1.Ticker.enabled": - return protoreflect.ValueOfBool(false) - case "slinky.mm2.v1.Ticker.metadata_JSON": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Ticker")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Ticker 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_Ticker) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.Ticker", 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_Ticker) 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_Ticker) 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_Ticker) 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_Ticker) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Ticker) - 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.CurrencyPair != nil { - l = options.Size(x.CurrencyPair) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Decimals != 0 { - n += 1 + runtime.Sov(uint64(x.Decimals)) - } - if x.MinProviderCount != 0 { - n += 1 + runtime.Sov(uint64(x.MinProviderCount)) - } - if x.Enabled { - n += 2 - } - l = len(x.Metadata_JSON) - 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().(*Ticker) - 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.Metadata_JSON) > 0 { - i -= len(x.Metadata_JSON) - copy(dAtA[i:], x.Metadata_JSON) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata_JSON))) - i-- - dAtA[i] = 0x7a - } - if x.Enabled { - i-- - if x.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } - if x.MinProviderCount != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.MinProviderCount)) - i-- - dAtA[i] = 0x18 - } - if x.Decimals != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.Decimals)) - i-- - dAtA[i] = 0x10 - } - if x.CurrencyPair != nil { - encoded, err := options.Marshal(x.CurrencyPair) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Ticker) - 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: Ticker: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Ticker: 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 CurrencyPair", 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.CurrencyPair == nil { - x.CurrencyPair = &v1.CurrencyPair{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) - } - x.Decimals = 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.Decimals |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MinProviderCount", wireType) - } - x.MinProviderCount = 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.MinProviderCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Enabled = bool(v != 0) - case 15: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", 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.Metadata_JSON = 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_ProviderConfig protoreflect.MessageDescriptor - fd_ProviderConfig_name protoreflect.FieldDescriptor - fd_ProviderConfig_off_chain_ticker protoreflect.FieldDescriptor - fd_ProviderConfig_normalize_by_pair protoreflect.FieldDescriptor - fd_ProviderConfig_invert protoreflect.FieldDescriptor - fd_ProviderConfig_metadata_JSON protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_market_proto_init() - md_ProviderConfig = File_slinky_mm2_v1_market_proto.Messages().ByName("ProviderConfig") - fd_ProviderConfig_name = md_ProviderConfig.Fields().ByName("name") - fd_ProviderConfig_off_chain_ticker = md_ProviderConfig.Fields().ByName("off_chain_ticker") - fd_ProviderConfig_normalize_by_pair = md_ProviderConfig.Fields().ByName("normalize_by_pair") - fd_ProviderConfig_invert = md_ProviderConfig.Fields().ByName("invert") - fd_ProviderConfig_metadata_JSON = md_ProviderConfig.Fields().ByName("metadata_JSON") -} - -var _ protoreflect.Message = (*fastReflection_ProviderConfig)(nil) - -type fastReflection_ProviderConfig ProviderConfig - -func (x *ProviderConfig) ProtoReflect() protoreflect.Message { - return (*fastReflection_ProviderConfig)(x) -} - -func (x *ProviderConfig) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_market_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_ProviderConfig_messageType fastReflection_ProviderConfig_messageType -var _ protoreflect.MessageType = fastReflection_ProviderConfig_messageType{} - -type fastReflection_ProviderConfig_messageType struct{} - -func (x fastReflection_ProviderConfig_messageType) Zero() protoreflect.Message { - return (*fastReflection_ProviderConfig)(nil) -} -func (x fastReflection_ProviderConfig_messageType) New() protoreflect.Message { - return new(fastReflection_ProviderConfig) -} -func (x fastReflection_ProviderConfig_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ProviderConfig -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ProviderConfig) Descriptor() protoreflect.MessageDescriptor { - return md_ProviderConfig -} - -// 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_ProviderConfig) Type() protoreflect.MessageType { - return _fastReflection_ProviderConfig_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ProviderConfig) New() protoreflect.Message { - return new(fastReflection_ProviderConfig) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ProviderConfig) Interface() protoreflect.ProtoMessage { - return (*ProviderConfig)(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_ProviderConfig) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Name != "" { - value := protoreflect.ValueOfString(x.Name) - if !f(fd_ProviderConfig_name, value) { - return - } - } - if x.OffChainTicker != "" { - value := protoreflect.ValueOfString(x.OffChainTicker) - if !f(fd_ProviderConfig_off_chain_ticker, value) { - return - } - } - if x.NormalizeByPair != nil { - value := protoreflect.ValueOfMessage(x.NormalizeByPair.ProtoReflect()) - if !f(fd_ProviderConfig_normalize_by_pair, value) { - return - } - } - if x.Invert != false { - value := protoreflect.ValueOfBool(x.Invert) - if !f(fd_ProviderConfig_invert, value) { - return - } - } - if x.Metadata_JSON != "" { - value := protoreflect.ValueOfString(x.Metadata_JSON) - if !f(fd_ProviderConfig_metadata_JSON, 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_ProviderConfig) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.ProviderConfig.name": - return x.Name != "" - case "slinky.mm2.v1.ProviderConfig.off_chain_ticker": - return x.OffChainTicker != "" - case "slinky.mm2.v1.ProviderConfig.normalize_by_pair": - return x.NormalizeByPair != nil - case "slinky.mm2.v1.ProviderConfig.invert": - return x.Invert != false - case "slinky.mm2.v1.ProviderConfig.metadata_JSON": - return x.Metadata_JSON != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ProviderConfig")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ProviderConfig 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_ProviderConfig) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.ProviderConfig.name": - x.Name = "" - case "slinky.mm2.v1.ProviderConfig.off_chain_ticker": - x.OffChainTicker = "" - case "slinky.mm2.v1.ProviderConfig.normalize_by_pair": - x.NormalizeByPair = nil - case "slinky.mm2.v1.ProviderConfig.invert": - x.Invert = false - case "slinky.mm2.v1.ProviderConfig.metadata_JSON": - x.Metadata_JSON = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ProviderConfig")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ProviderConfig 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_ProviderConfig) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.ProviderConfig.name": - value := x.Name - return protoreflect.ValueOfString(value) - case "slinky.mm2.v1.ProviderConfig.off_chain_ticker": - value := x.OffChainTicker - return protoreflect.ValueOfString(value) - case "slinky.mm2.v1.ProviderConfig.normalize_by_pair": - value := x.NormalizeByPair - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.mm2.v1.ProviderConfig.invert": - value := x.Invert - return protoreflect.ValueOfBool(value) - case "slinky.mm2.v1.ProviderConfig.metadata_JSON": - value := x.Metadata_JSON - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ProviderConfig")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ProviderConfig 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_ProviderConfig) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.ProviderConfig.name": - x.Name = value.Interface().(string) - case "slinky.mm2.v1.ProviderConfig.off_chain_ticker": - x.OffChainTicker = value.Interface().(string) - case "slinky.mm2.v1.ProviderConfig.normalize_by_pair": - x.NormalizeByPair = value.Message().Interface().(*v1.CurrencyPair) - case "slinky.mm2.v1.ProviderConfig.invert": - x.Invert = value.Bool() - case "slinky.mm2.v1.ProviderConfig.metadata_JSON": - x.Metadata_JSON = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ProviderConfig")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ProviderConfig 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_ProviderConfig) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.ProviderConfig.normalize_by_pair": - if x.NormalizeByPair == nil { - x.NormalizeByPair = new(v1.CurrencyPair) - } - return protoreflect.ValueOfMessage(x.NormalizeByPair.ProtoReflect()) - case "slinky.mm2.v1.ProviderConfig.name": - panic(fmt.Errorf("field name of message slinky.mm2.v1.ProviderConfig is not mutable")) - case "slinky.mm2.v1.ProviderConfig.off_chain_ticker": - panic(fmt.Errorf("field off_chain_ticker of message slinky.mm2.v1.ProviderConfig is not mutable")) - case "slinky.mm2.v1.ProviderConfig.invert": - panic(fmt.Errorf("field invert of message slinky.mm2.v1.ProviderConfig is not mutable")) - case "slinky.mm2.v1.ProviderConfig.metadata_JSON": - panic(fmt.Errorf("field metadata_JSON of message slinky.mm2.v1.ProviderConfig is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ProviderConfig")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ProviderConfig 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_ProviderConfig) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.ProviderConfig.name": - return protoreflect.ValueOfString("") - case "slinky.mm2.v1.ProviderConfig.off_chain_ticker": - return protoreflect.ValueOfString("") - case "slinky.mm2.v1.ProviderConfig.normalize_by_pair": - m := new(v1.CurrencyPair) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.mm2.v1.ProviderConfig.invert": - return protoreflect.ValueOfBool(false) - case "slinky.mm2.v1.ProviderConfig.metadata_JSON": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ProviderConfig")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ProviderConfig 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_ProviderConfig) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.ProviderConfig", 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_ProviderConfig) 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_ProviderConfig) 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_ProviderConfig) 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_ProviderConfig) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ProviderConfig) - 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.Name) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.OffChainTicker) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.NormalizeByPair != nil { - l = options.Size(x.NormalizeByPair) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.Invert { - n += 2 - } - l = len(x.Metadata_JSON) - 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().(*ProviderConfig) - 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.Metadata_JSON) > 0 { - i -= len(x.Metadata_JSON) - copy(dAtA[i:], x.Metadata_JSON) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Metadata_JSON))) - i-- - dAtA[i] = 0x7a - } - if x.Invert { - i-- - if x.Invert { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if x.NormalizeByPair != nil { - encoded, err := options.Marshal(x.NormalizeByPair) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if len(x.OffChainTicker) > 0 { - i -= len(x.OffChainTicker) - copy(dAtA[i:], x.OffChainTicker) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.OffChainTicker))) - i-- - dAtA[i] = 0x12 - } - if len(x.Name) > 0 { - i -= len(x.Name) - copy(dAtA[i:], x.Name) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Name))) - 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().(*ProviderConfig) - 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: ProviderConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ProviderConfig: 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 Name", 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.Name = 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 OffChainTicker", 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.OffChainTicker = 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 NormalizeByPair", 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.NormalizeByPair == nil { - x.NormalizeByPair = &v1.CurrencyPair{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.NormalizeByPair); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Invert", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - x.Invert = bool(v != 0) - case 15: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", 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.Metadata_JSON = 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 _ protoreflect.Map = (*_MarketMap_1_map)(nil) - -type _MarketMap_1_map struct { - m *map[string]*Market -} - -func (x *_MarketMap_1_map) Len() int { - if x.m == nil { - return 0 - } - return len(*x.m) -} - -func (x *_MarketMap_1_map) Range(f func(protoreflect.MapKey, protoreflect.Value) bool) { - if x.m == nil { - return - } - for k, v := range *x.m { - mapKey := (protoreflect.MapKey)(protoreflect.ValueOfString(k)) - mapValue := protoreflect.ValueOfMessage(v.ProtoReflect()) - if !f(mapKey, mapValue) { - break - } - } -} - -func (x *_MarketMap_1_map) Has(key protoreflect.MapKey) bool { - if x.m == nil { - return false - } - keyUnwrapped := key.String() - concreteValue := keyUnwrapped - _, ok := (*x.m)[concreteValue] - return ok -} - -func (x *_MarketMap_1_map) Clear(key protoreflect.MapKey) { - if x.m == nil { - return - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - delete(*x.m, concreteKey) -} - -func (x *_MarketMap_1_map) Get(key protoreflect.MapKey) protoreflect.Value { - if x.m == nil { - return protoreflect.Value{} - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if !ok { - return protoreflect.Value{} - } - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_1_map) Set(key protoreflect.MapKey, value protoreflect.Value) { - if !key.IsValid() || !value.IsValid() { - panic("invalid key or value provided") - } - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Market) - (*x.m)[concreteKey] = concreteValue -} - -func (x *_MarketMap_1_map) Mutable(key protoreflect.MapKey) protoreflect.Value { - keyUnwrapped := key.String() - concreteKey := keyUnwrapped - v, ok := (*x.m)[concreteKey] - if ok { - return protoreflect.ValueOfMessage(v.ProtoReflect()) - } - newValue := new(Market) - (*x.m)[concreteKey] = newValue - return protoreflect.ValueOfMessage(newValue.ProtoReflect()) -} - -func (x *_MarketMap_1_map) NewValue() protoreflect.Value { - v := new(Market) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MarketMap_1_map) IsValid() bool { - return x.m != nil -} - -var ( - md_MarketMap protoreflect.MessageDescriptor - fd_MarketMap_markets protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_market_proto_init() - md_MarketMap = File_slinky_mm2_v1_market_proto.Messages().ByName("MarketMap") - fd_MarketMap_markets = md_MarketMap.Fields().ByName("markets") -} - -var _ protoreflect.Message = (*fastReflection_MarketMap)(nil) - -type fastReflection_MarketMap MarketMap - -func (x *MarketMap) ProtoReflect() protoreflect.Message { - return (*fastReflection_MarketMap)(x) -} - -func (x *MarketMap) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_market_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_MarketMap_messageType fastReflection_MarketMap_messageType -var _ protoreflect.MessageType = fastReflection_MarketMap_messageType{} - -type fastReflection_MarketMap_messageType struct{} - -func (x fastReflection_MarketMap_messageType) Zero() protoreflect.Message { - return (*fastReflection_MarketMap)(nil) -} -func (x fastReflection_MarketMap_messageType) New() protoreflect.Message { - return new(fastReflection_MarketMap) -} -func (x fastReflection_MarketMap_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMap -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MarketMap) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMap -} - -// 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_MarketMap) Type() protoreflect.MessageType { - return _fastReflection_MarketMap_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MarketMap) New() protoreflect.Message { - return new(fastReflection_MarketMap) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MarketMap) Interface() protoreflect.ProtoMessage { - return (*MarketMap)(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_MarketMap) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.Markets) != 0 { - value := protoreflect.ValueOfMap(&_MarketMap_1_map{m: &x.Markets}) - if !f(fd_MarketMap_markets, 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_MarketMap) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMap.markets": - return len(x.Markets) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMap 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_MarketMap) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMap.markets": - x.Markets = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMap 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_MarketMap) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MarketMap.markets": - if len(x.Markets) == 0 { - return protoreflect.ValueOfMap(&_MarketMap_1_map{}) - } - mapValue := &_MarketMap_1_map{m: &x.Markets} - return protoreflect.ValueOfMap(mapValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMap 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_MarketMap) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMap.markets": - mv := value.Map() - cmv := mv.(*_MarketMap_1_map) - x.Markets = *cmv.m - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMap 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_MarketMap) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMap.markets": - if x.Markets == nil { - x.Markets = make(map[string]*Market) - } - value := &_MarketMap_1_map{m: &x.Markets} - return protoreflect.ValueOfMap(value) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMap 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_MarketMap) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMap.markets": - m := make(map[string]*Market) - return protoreflect.ValueOfMap(&_MarketMap_1_map{m: &m}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMap")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMap 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_MarketMap) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MarketMap", 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_MarketMap) 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_MarketMap) 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_MarketMap) 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_MarketMap) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MarketMap) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.Markets) > 0 { - SiZeMaP := func(k string, v *Market) { - l := 0 - if v != nil { - l = options.Size(v) - } - l += 1 + runtime.Sov(uint64(l)) - mapEntrySize := 1 + len(k) + runtime.Sov(uint64(len(k))) + l - n += mapEntrySize + 1 + runtime.Sov(uint64(mapEntrySize)) - } - if options.Deterministic { - sortme := make([]string, 0, len(x.Markets)) - for k := range x.Markets { - sortme = append(sortme, k) - } - sort.Strings(sortme) - for _, k := range sortme { - v := x.Markets[k] - SiZeMaP(k, v) - } - } else { - for k, v := range x.Markets { - SiZeMaP(k, v) - } - } - } - 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().(*MarketMap) - 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.Markets) > 0 { - MaRsHaLmAp := func(k string, v *Market) (protoiface.MarshalOutput, error) { - baseI := i - encoded, err := options.Marshal(v) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = runtime.EncodeVarint(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = runtime.EncodeVarint(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - return protoiface.MarshalOutput{}, nil - } - if options.Deterministic { - keysForMarkets := make([]string, 0, len(x.Markets)) - for k := range x.Markets { - keysForMarkets = append(keysForMarkets, string(k)) - } - sort.Slice(keysForMarkets, func(i, j int) bool { - return keysForMarkets[i] < keysForMarkets[j] - }) - for iNdEx := len(keysForMarkets) - 1; iNdEx >= 0; iNdEx-- { - v := x.Markets[string(keysForMarkets[iNdEx])] - out, err := MaRsHaLmAp(keysForMarkets[iNdEx], v) - if err != nil { - return out, err - } - } - } else { - for k := range x.Markets { - v := x.Markets[k] - out, err := MaRsHaLmAp(k, v) - if err != nil { - return out, err - } - } - } - } - 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().(*MarketMap) - 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: MarketMap: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMap: 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 Markets", 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.Markets == nil { - x.Markets = make(map[string]*Market) - } - var mapkey string - var mapvalue *Market - for iNdEx < postIndex { - entryPreIndex := 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) - if fieldNum == 1 { - var stringLenmapkey 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++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postStringIndexmapkey > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen 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++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postmsgIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - mapvalue = &Market{} - if err := options.Unmarshal(dAtA[iNdEx:postmsgIndex], mapvalue); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - 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) > postIndex { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - x.Markets[mapkey] = mapvalue - 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: slinky/mm2/v1/market.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) -) - -// Market encapsulates a Ticker and its provider-specific configuration. -type Market struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The - // price feed is scaled to a number of decimal places and has a minimum number - // of providers required to consider the ticker valid. - Ticker *Ticker `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker,omitempty"` - // ProviderConfigs is the list of provider-specific configs for this Market. - ProviderConfigs []*ProviderConfig `protobuf:"bytes,2,rep,name=provider_configs,json=providerConfigs,proto3" json:"provider_configs,omitempty"` -} - -func (x *Market) Reset() { - *x = Market{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_market_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Market) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Market) ProtoMessage() {} - -// Deprecated: Use Market.ProtoReflect.Descriptor instead. -func (*Market) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_market_proto_rawDescGZIP(), []int{0} -} - -func (x *Market) GetTicker() *Ticker { - if x != nil { - return x.Ticker - } - return nil -} - -func (x *Market) GetProviderConfigs() []*ProviderConfig { - if x != nil { - return x.ProviderConfigs - } - return nil -} - -// Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price -// feed is scaled to a number of decimal places and has a minimum number of -// providers required to consider the ticker valid. -type Ticker struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // CurrencyPair is the currency pair for this ticker. - CurrencyPair *v1.CurrencyPair `protobuf:"bytes,1,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair,omitempty"` - // Decimals is the number of decimal places for the ticker. The number of - // decimal places is used to convert the price to a human-readable format. - Decimals uint64 `protobuf:"varint,2,opt,name=decimals,proto3" json:"decimals,omitempty"` - // MinProviderCount is the minimum number of providers required to consider - // the ticker valid. - MinProviderCount uint64 `protobuf:"varint,3,opt,name=min_provider_count,json=minProviderCount,proto3" json:"min_provider_count,omitempty"` - // Enabled is the flag that denotes if the Ticker is enabled for price - // fetching by an oracle. - Enabled bool `protobuf:"varint,14,opt,name=enabled,proto3" json:"enabled,omitempty"` - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given ticker. - Metadata_JSON string `protobuf:"bytes,15,opt,name=metadata_JSON,json=metadataJSON,proto3" json:"metadata_JSON,omitempty"` -} - -func (x *Ticker) Reset() { - *x = Ticker{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_market_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Ticker) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Ticker) ProtoMessage() {} - -// Deprecated: Use Ticker.ProtoReflect.Descriptor instead. -func (*Ticker) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_market_proto_rawDescGZIP(), []int{1} -} - -func (x *Ticker) GetCurrencyPair() *v1.CurrencyPair { - if x != nil { - return x.CurrencyPair - } - return nil -} - -func (x *Ticker) GetDecimals() uint64 { - if x != nil { - return x.Decimals - } - return 0 -} - -func (x *Ticker) GetMinProviderCount() uint64 { - if x != nil { - return x.MinProviderCount - } - return 0 -} - -func (x *Ticker) GetEnabled() bool { - if x != nil { - return x.Enabled - } - return false -} - -func (x *Ticker) GetMetadata_JSON() string { - if x != nil { - return x.Metadata_JSON - } - return "" -} - -type ProviderConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Name corresponds to the name of the provider for which the configuration is - // being set. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // OffChainTicker is the off-chain representation of the ticker i.e. BTC/USD. - // The off-chain ticker is unique to a given provider and is used to fetch the - // price of the ticker from the provider. - OffChainTicker string `protobuf:"bytes,2,opt,name=off_chain_ticker,json=offChainTicker,proto3" json:"off_chain_ticker,omitempty"` - // NormalizeByPair is the currency pair for this ticker to be normalized by. - // For example, if the desired Ticker is BTD/USD, this market could be reached - // using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is - // optional and nullable. - NormalizeByPair *v1.CurrencyPair `protobuf:"bytes,3,opt,name=normalize_by_pair,json=normalizeByPair,proto3" json:"normalize_by_pair,omitempty"` - // Invert is a boolean indicating if the BASE and QUOTE of the market should - // be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE - Invert bool `protobuf:"varint,4,opt,name=invert,proto3" json:"invert,omitempty"` - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given provider config. - Metadata_JSON string `protobuf:"bytes,15,opt,name=metadata_JSON,json=metadataJSON,proto3" json:"metadata_JSON,omitempty"` -} - -func (x *ProviderConfig) Reset() { - *x = ProviderConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_market_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ProviderConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ProviderConfig) ProtoMessage() {} - -// Deprecated: Use ProviderConfig.ProtoReflect.Descriptor instead. -func (*ProviderConfig) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_market_proto_rawDescGZIP(), []int{2} -} - -func (x *ProviderConfig) GetName() string { - if x != nil { - return x.Name - } - return "" -} - -func (x *ProviderConfig) GetOffChainTicker() string { - if x != nil { - return x.OffChainTicker - } - return "" -} - -func (x *ProviderConfig) GetNormalizeByPair() *v1.CurrencyPair { - if x != nil { - return x.NormalizeByPair - } - return nil -} - -func (x *ProviderConfig) GetInvert() bool { - if x != nil { - return x.Invert - } - return false -} - -func (x *ProviderConfig) GetMetadata_JSON() string { - if x != nil { - return x.Metadata_JSON - } - return "" -} - -// MarketMap maps ticker strings to their Markets. -type MarketMap struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Markets is the full list of tickers and their associated configurations - // to be stored on-chain. - Markets map[string]*Market `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (x *MarketMap) Reset() { - *x = MarketMap{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_market_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MarketMap) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MarketMap) ProtoMessage() {} - -// Deprecated: Use MarketMap.ProtoReflect.Descriptor instead. -func (*MarketMap) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_market_proto_rawDescGZIP(), []int{3} -} - -func (x *MarketMap) GetMarkets() map[string]*Market { - if x != nil { - return x.Markets - } - return nil -} - -var File_slinky_mm2_v1_market_proto protoreflect.FileDescriptor - -var file_slinky_mm2_v1_market_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, - 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, - 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, - 0x6f, 0x1a, 0x23, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, - 0x76, 0x31, 0x2f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x97, 0x01, 0x0a, 0x06, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x12, 0x33, 0x0a, 0x06, 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, - 0x31, 0x2e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, - 0x74, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x4e, 0x0a, 0x10, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, - 0x65, 0x72, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, - 0x2e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, - 0x22, 0xe5, 0x01, 0x0a, 0x06, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x48, 0x0a, 0x0d, 0x63, - 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, - 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, - 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, - 0x79, 0x50, 0x61, 0x69, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x08, 0x64, 0x65, 0x63, 0x69, 0x6d, 0x61, 0x6c, - 0x73, 0x12, 0x2c, 0x0a, 0x12, 0x6d, 0x69, 0x6e, 0x5f, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, - 0x72, 0x5f, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x04, 0x52, 0x10, 0x6d, - 0x69, 0x6e, 0x50, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x75, 0x6e, 0x74, 0x12, - 0x18, 0x0a, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x08, - 0x52, 0x07, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x64, 0x12, 0x23, 0x0a, 0x0d, 0x6d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0f, 0x20, 0x01, 0x28, 0x09, - 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4a, 0x53, 0x4f, 0x4e, 0x3a, 0x08, - 0x98, 0xa0, 0x1f, 0x00, 0x80, 0xdc, 0x20, 0x00, 0x22, 0xd6, 0x01, 0x0a, 0x0e, 0x50, 0x72, 0x6f, - 0x76, 0x69, 0x64, 0x65, 0x72, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x12, 0x0a, 0x04, 0x6e, - 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, - 0x28, 0x0a, 0x10, 0x6f, 0x66, 0x66, 0x5f, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x5f, 0x74, 0x69, 0x63, - 0x6b, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x6f, 0x66, 0x66, 0x43, 0x68, - 0x61, 0x69, 0x6e, 0x54, 0x69, 0x63, 0x6b, 0x65, 0x72, 0x12, 0x49, 0x0a, 0x11, 0x6e, 0x6f, 0x72, - 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x5f, 0x62, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x18, 0x03, - 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, - 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, - 0x61, 0x69, 0x72, 0x52, 0x0f, 0x6e, 0x6f, 0x72, 0x6d, 0x61, 0x6c, 0x69, 0x7a, 0x65, 0x42, 0x79, - 0x50, 0x61, 0x69, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x18, 0x04, - 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x6e, 0x76, 0x65, 0x72, 0x74, 0x12, 0x23, 0x0a, 0x0d, - 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x5f, 0x4a, 0x53, 0x4f, 0x4e, 0x18, 0x0f, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x0c, 0x6d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0x4a, 0x53, 0x4f, - 0x4e, 0x22, 0xaf, 0x01, 0x0a, 0x09, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x12, - 0x45, 0x0a, 0x07, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x25, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x51, 0x0a, 0x0c, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x2b, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x05, - 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x3a, 0x08, 0x98, 0xa0, 0x1f, 0x00, 0x80, - 0xdc, 0x20, 0x00, 0x42, 0x9c, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x42, 0x0b, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6d, 0x32, 0x76, 0x31, 0xa2, 0x02, - 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x6d, - 0x32, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, - 0x32, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, - 0x32, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x0f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x6d, 0x32, 0x3a, 0x3a, - 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_mm2_v1_market_proto_rawDescOnce sync.Once - file_slinky_mm2_v1_market_proto_rawDescData = file_slinky_mm2_v1_market_proto_rawDesc -) - -func file_slinky_mm2_v1_market_proto_rawDescGZIP() []byte { - file_slinky_mm2_v1_market_proto_rawDescOnce.Do(func() { - file_slinky_mm2_v1_market_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_mm2_v1_market_proto_rawDescData) - }) - return file_slinky_mm2_v1_market_proto_rawDescData -} - -var file_slinky_mm2_v1_market_proto_msgTypes = make([]protoimpl.MessageInfo, 5) -var file_slinky_mm2_v1_market_proto_goTypes = []interface{}{ - (*Market)(nil), // 0: slinky.mm2.v1.Market - (*Ticker)(nil), // 1: slinky.mm2.v1.Ticker - (*ProviderConfig)(nil), // 2: slinky.mm2.v1.ProviderConfig - (*MarketMap)(nil), // 3: slinky.mm2.v1.MarketMap - nil, // 4: slinky.mm2.v1.MarketMap.MarketsEntry - (*v1.CurrencyPair)(nil), // 5: slinky.types.v1.CurrencyPair -} -var file_slinky_mm2_v1_market_proto_depIdxs = []int32{ - 1, // 0: slinky.mm2.v1.Market.ticker:type_name -> slinky.mm2.v1.Ticker - 2, // 1: slinky.mm2.v1.Market.provider_configs:type_name -> slinky.mm2.v1.ProviderConfig - 5, // 2: slinky.mm2.v1.Ticker.currency_pair:type_name -> slinky.types.v1.CurrencyPair - 5, // 3: slinky.mm2.v1.ProviderConfig.normalize_by_pair:type_name -> slinky.types.v1.CurrencyPair - 4, // 4: slinky.mm2.v1.MarketMap.markets:type_name -> slinky.mm2.v1.MarketMap.MarketsEntry - 0, // 5: slinky.mm2.v1.MarketMap.MarketsEntry.value:type_name -> slinky.mm2.v1.Market - 6, // [6:6] is the sub-list for method output_type - 6, // [6:6] is the sub-list for method input_type - 6, // [6:6] is the sub-list for extension type_name - 6, // [6:6] is the sub-list for extension extendee - 0, // [0:6] is the sub-list for field type_name -} - -func init() { file_slinky_mm2_v1_market_proto_init() } -func file_slinky_mm2_v1_market_proto_init() { - if File_slinky_mm2_v1_market_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_mm2_v1_market_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Market); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_market_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Ticker); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_market_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ProviderConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_market_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarketMap); 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_slinky_mm2_v1_market_proto_rawDesc, - NumEnums: 0, - NumMessages: 5, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_mm2_v1_market_proto_goTypes, - DependencyIndexes: file_slinky_mm2_v1_market_proto_depIdxs, - MessageInfos: file_slinky_mm2_v1_market_proto_msgTypes, - }.Build() - File_slinky_mm2_v1_market_proto = out.File - file_slinky_mm2_v1_market_proto_rawDesc = nil - file_slinky_mm2_v1_market_proto_goTypes = nil - file_slinky_mm2_v1_market_proto_depIdxs = nil -} diff --git a/api/slinky/mm2/v1/params.pulsar.go b/api/slinky/mm2/v1/params.pulsar.go deleted file mode 100644 index d610a8fc0..000000000 --- a/api/slinky/mm2/v1/params.pulsar.go +++ /dev/null @@ -1,705 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package mm2v1 - -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 _ protoreflect.List = (*_Params_1_list)(nil) - -type _Params_1_list struct { - list *[]string -} - -func (x *_Params_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_Params_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_Params_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_Params_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_Params_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message Params at list field MarketAuthorities as it is not of Message kind")) -} - -func (x *_Params_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_Params_1_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_Params_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_Params protoreflect.MessageDescriptor - fd_Params_market_authorities protoreflect.FieldDescriptor - fd_Params_admin protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_params_proto_init() - md_Params = File_slinky_mm2_v1_params_proto.Messages().ByName("Params") - fd_Params_market_authorities = md_Params.Fields().ByName("market_authorities") - fd_Params_admin = md_Params.Fields().ByName("admin") -} - -var _ protoreflect.Message = (*fastReflection_Params)(nil) - -type fastReflection_Params Params - -func (x *Params) ProtoReflect() protoreflect.Message { - return (*fastReflection_Params)(x) -} - -func (x *Params) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_params_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_Params_messageType fastReflection_Params_messageType -var _ protoreflect.MessageType = fastReflection_Params_messageType{} - -type fastReflection_Params_messageType struct{} - -func (x fastReflection_Params_messageType) Zero() protoreflect.Message { - return (*fastReflection_Params)(nil) -} -func (x fastReflection_Params_messageType) New() protoreflect.Message { - return new(fastReflection_Params) -} -func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { - return md_Params -} - -// 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_Params) Type() protoreflect.MessageType { - return _fastReflection_Params_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_Params) New() protoreflect.Message { - return new(fastReflection_Params) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { - return (*Params)(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_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.MarketAuthorities) != 0 { - value := protoreflect.ValueOfList(&_Params_1_list{list: &x.MarketAuthorities}) - if !f(fd_Params_market_authorities, value) { - return - } - } - if x.Admin != "" { - value := protoreflect.ValueOfString(x.Admin) - if !f(fd_Params_admin, 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_Params) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.Params.market_authorities": - return len(x.MarketAuthorities) != 0 - case "slinky.mm2.v1.Params.admin": - return x.Admin != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Params")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Params 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_Params) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.Params.market_authorities": - x.MarketAuthorities = nil - case "slinky.mm2.v1.Params.admin": - x.Admin = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Params")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Params 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_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.Params.market_authorities": - if len(x.MarketAuthorities) == 0 { - return protoreflect.ValueOfList(&_Params_1_list{}) - } - listValue := &_Params_1_list{list: &x.MarketAuthorities} - return protoreflect.ValueOfList(listValue) - case "slinky.mm2.v1.Params.admin": - value := x.Admin - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Params")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Params 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_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.Params.market_authorities": - lv := value.List() - clv := lv.(*_Params_1_list) - x.MarketAuthorities = *clv.list - case "slinky.mm2.v1.Params.admin": - x.Admin = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Params")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Params does not contain field %s", fd.FullName())) - } -} - -// Mutable returns a mutable reference to a composite type. -// -// If the field is unpopulated, it may allocate a composite value. -// For a field belonging to a oneof, it implicitly clears any other field -// that may be currently set within the same oneof. -// For extension fields, it implicitly stores the provided ExtensionType -// if not already stored. -// It panics if the field does not contain a composite type. -// -// Mutable is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.Params.market_authorities": - if x.MarketAuthorities == nil { - x.MarketAuthorities = []string{} - } - value := &_Params_1_list{list: &x.MarketAuthorities} - return protoreflect.ValueOfList(value) - case "slinky.mm2.v1.Params.admin": - panic(fmt.Errorf("field admin of message slinky.mm2.v1.Params is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Params")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Params does not contain field %s", fd.FullName())) - } -} - -// NewField returns a new value that is assignable to the field -// for the given descriptor. For scalars, this returns the default value. -// For lists, maps, and messages, this returns a new, empty, mutable value. -func (x *fastReflection_Params) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.Params.market_authorities": - list := []string{} - return protoreflect.ValueOfList(&_Params_1_list{list: &list}) - case "slinky.mm2.v1.Params.admin": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.Params")) - } - panic(fmt.Errorf("message slinky.mm2.v1.Params does not contain field %s", fd.FullName())) - } -} - -// WhichOneof reports which field within the oneof is populated, -// returning nil if none are populated. -// It panics if the oneof descriptor does not belong to this message. -func (x *fastReflection_Params) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.Params", d.FullName())) - } - panic("unreachable") -} - -// GetUnknown retrieves the entire list of unknown fields. -// The caller may only mutate the contents of the RawFields -// if the mutated bytes are stored back into the message with SetUnknown. -func (x *fastReflection_Params) GetUnknown() protoreflect.RawFields { - return x.unknownFields -} - -// SetUnknown stores an entire list of unknown fields. -// The raw fields must be syntactically valid according to the wire format. -// An implementation may panic if this is not the case. -// Once stored, the caller must not mutate the content of the RawFields. -// An empty RawFields may be passed to clear the fields. -// -// SetUnknown is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) SetUnknown(fields protoreflect.RawFields) { - x.unknownFields = fields -} - -// IsValid reports whether the message is valid. -// -// An invalid message is an empty, read-only value. -// -// An invalid message often corresponds to a nil pointer of the concrete -// message type, but the details are implementation dependent. -// Validity is not part of the protobuf data model, and may not -// be preserved in marshaling or other operations. -func (x *fastReflection_Params) IsValid() bool { - return x != nil -} - -// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations. -// This method may return nil. -// -// The returned methods type is identical to -// "google.golang.org/protobuf/runtime/protoiface".Methods. -// Consult the protoiface package documentation for details. -func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.MarketAuthorities) > 0 { - for _, s := range x.MarketAuthorities { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - l = len(x.Admin) - 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().(*Params) - if x == nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - options := runtime.MarshalInputToOptions(input) - _ = options - size := options.Size(x) - dAtA := make([]byte, size) - i := len(dAtA) - _ = i - var l int - _ = l - if x.unknownFields != nil { - i -= len(x.unknownFields) - copy(dAtA[i:], x.unknownFields) - } - if len(x.Admin) > 0 { - i -= len(x.Admin) - copy(dAtA[i:], x.Admin) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) - i-- - dAtA[i] = 0x12 - } - if len(x.MarketAuthorities) > 0 { - for iNdEx := len(x.MarketAuthorities) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.MarketAuthorities[iNdEx]) - copy(dAtA[i:], x.MarketAuthorities[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.MarketAuthorities[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Params) - if x == nil { - return protoiface.UnmarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Flags: input.Flags, - }, nil - } - options := runtime.UnmarshalInputToOptions(input) - _ = options - dAtA := input.Buf - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field MarketAuthorities", 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.MarketAuthorities = append(x.MarketAuthorities, 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 Admin", 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.Admin = 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: slinky/mm2/v1/params.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) -) - -// Params defines the parameters for the x/marketmap module. -type Params struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // MarketAuthorities is the list of authority accounts that are able to - // control updating the marketmap. - MarketAuthorities []string `protobuf:"bytes,1,rep,name=market_authorities,json=marketAuthorities,proto3" json:"market_authorities,omitempty"` - // Admin is an address that can remove addresses from the MarketAuthorities - // list. Only governance can add to the MarketAuthorities or change the Admin. - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` -} - -func (x *Params) Reset() { - *x = Params{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_params_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *Params) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*Params) ProtoMessage() {} - -// Deprecated: Use Params.ProtoReflect.Descriptor instead. -func (*Params) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_params_proto_rawDescGZIP(), []int{0} -} - -func (x *Params) GetMarketAuthorities() []string { - if x != nil { - return x.MarketAuthorities - } - return nil -} - -func (x *Params) GetAdmin() string { - if x != nil { - return x.Admin - } - return "" -} - -var File_slinky_mm2_v1_params_proto protoreflect.FileDescriptor - -var file_slinky_mm2_v1_params_proto_rawDesc = []byte{ - 0x0a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x22, 0x4d, 0x0a, 0x06, 0x50, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x2d, 0x0a, 0x12, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, - 0x09, 0x52, 0x11, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x42, 0x9c, 0x01, 0x0a, 0x11, 0x63, - 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, - 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x3b, - 0x6d, 0x6d, 0x32, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x6d, 0x32, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x3a, 0x3a, 0x4d, 0x6d, 0x32, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_slinky_mm2_v1_params_proto_rawDescOnce sync.Once - file_slinky_mm2_v1_params_proto_rawDescData = file_slinky_mm2_v1_params_proto_rawDesc -) - -func file_slinky_mm2_v1_params_proto_rawDescGZIP() []byte { - file_slinky_mm2_v1_params_proto_rawDescOnce.Do(func() { - file_slinky_mm2_v1_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_mm2_v1_params_proto_rawDescData) - }) - return file_slinky_mm2_v1_params_proto_rawDescData -} - -var file_slinky_mm2_v1_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_slinky_mm2_v1_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: slinky.mm2.v1.Params -} -var file_slinky_mm2_v1_params_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_slinky_mm2_v1_params_proto_init() } -func file_slinky_mm2_v1_params_proto_init() { - if File_slinky_mm2_v1_params_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_slinky_mm2_v1_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*Params); 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_slinky_mm2_v1_params_proto_rawDesc, - NumEnums: 0, - NumMessages: 1, - NumExtensions: 0, - NumServices: 0, - }, - GoTypes: file_slinky_mm2_v1_params_proto_goTypes, - DependencyIndexes: file_slinky_mm2_v1_params_proto_depIdxs, - MessageInfos: file_slinky_mm2_v1_params_proto_msgTypes, - }.Build() - File_slinky_mm2_v1_params_proto = out.File - file_slinky_mm2_v1_params_proto_rawDesc = nil - file_slinky_mm2_v1_params_proto_goTypes = nil - file_slinky_mm2_v1_params_proto_depIdxs = nil -} diff --git a/api/slinky/mm2/v1/query.pulsar.go b/api/slinky/mm2/v1/query.pulsar.go deleted file mode 100644 index 208b3e33b..000000000 --- a/api/slinky/mm2/v1/query.pulsar.go +++ /dev/null @@ -1,3902 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package mm2v1 - -import ( - fmt "fmt" - runtime "github.com/cosmos/cosmos-proto/runtime" - _ "github.com/cosmos/gogoproto/gogoproto" - v1 "github.com/skip-mev/slinky/api/slinky/types/v1" - _ "google.golang.org/genproto/googleapis/api/annotations" - 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_MarketMapRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_MarketMapRequest = File_slinky_mm2_v1_query_proto.Messages().ByName("MarketMapRequest") -} - -var _ protoreflect.Message = (*fastReflection_MarketMapRequest)(nil) - -type fastReflection_MarketMapRequest MarketMapRequest - -func (x *MarketMapRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_MarketMapRequest)(x) -} - -func (x *MarketMapRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_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_MarketMapRequest_messageType fastReflection_MarketMapRequest_messageType -var _ protoreflect.MessageType = fastReflection_MarketMapRequest_messageType{} - -type fastReflection_MarketMapRequest_messageType struct{} - -func (x fastReflection_MarketMapRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_MarketMapRequest)(nil) -} -func (x fastReflection_MarketMapRequest_messageType) New() protoreflect.Message { - return new(fastReflection_MarketMapRequest) -} -func (x fastReflection_MarketMapRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMapRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MarketMapRequest) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMapRequest -} - -// 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_MarketMapRequest) Type() protoreflect.MessageType { - return _fastReflection_MarketMapRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MarketMapRequest) New() protoreflect.Message { - return new(fastReflection_MarketMapRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MarketMapRequest) Interface() protoreflect.ProtoMessage { - return (*MarketMapRequest)(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_MarketMapRequest) 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_MarketMapRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapRequest 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_MarketMapRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapRequest 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_MarketMapRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapRequest 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_MarketMapRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapRequest 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_MarketMapRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapRequest 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_MarketMapRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapRequest 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_MarketMapRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MarketMapRequest", 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_MarketMapRequest) 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_MarketMapRequest) 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_MarketMapRequest) 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_MarketMapRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MarketMapRequest) - 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().(*MarketMapRequest) - 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().(*MarketMapRequest) - 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: MarketMapRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMapRequest: 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, - } -} - -var ( - md_MarketMapResponse protoreflect.MessageDescriptor - fd_MarketMapResponse_market_map protoreflect.FieldDescriptor - fd_MarketMapResponse_last_updated protoreflect.FieldDescriptor - fd_MarketMapResponse_chain_id protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_MarketMapResponse = File_slinky_mm2_v1_query_proto.Messages().ByName("MarketMapResponse") - fd_MarketMapResponse_market_map = md_MarketMapResponse.Fields().ByName("market_map") - fd_MarketMapResponse_last_updated = md_MarketMapResponse.Fields().ByName("last_updated") - fd_MarketMapResponse_chain_id = md_MarketMapResponse.Fields().ByName("chain_id") -} - -var _ protoreflect.Message = (*fastReflection_MarketMapResponse)(nil) - -type fastReflection_MarketMapResponse MarketMapResponse - -func (x *MarketMapResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MarketMapResponse)(x) -} - -func (x *MarketMapResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_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_MarketMapResponse_messageType fastReflection_MarketMapResponse_messageType -var _ protoreflect.MessageType = fastReflection_MarketMapResponse_messageType{} - -type fastReflection_MarketMapResponse_messageType struct{} - -func (x fastReflection_MarketMapResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MarketMapResponse)(nil) -} -func (x fastReflection_MarketMapResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MarketMapResponse) -} -func (x fastReflection_MarketMapResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMapResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MarketMapResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MarketMapResponse -} - -// 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_MarketMapResponse) Type() protoreflect.MessageType { - return _fastReflection_MarketMapResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MarketMapResponse) New() protoreflect.Message { - return new(fastReflection_MarketMapResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MarketMapResponse) Interface() protoreflect.ProtoMessage { - return (*MarketMapResponse)(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_MarketMapResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.MarketMap != nil { - value := protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) - if !f(fd_MarketMapResponse_market_map, value) { - return - } - } - if x.LastUpdated != uint64(0) { - value := protoreflect.ValueOfUint64(x.LastUpdated) - if !f(fd_MarketMapResponse_last_updated, value) { - return - } - } - if x.ChainId != "" { - value := protoreflect.ValueOfString(x.ChainId) - if !f(fd_MarketMapResponse_chain_id, 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_MarketMapResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMapResponse.market_map": - return x.MarketMap != nil - case "slinky.mm2.v1.MarketMapResponse.last_updated": - return x.LastUpdated != uint64(0) - case "slinky.mm2.v1.MarketMapResponse.chain_id": - return x.ChainId != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapResponse 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_MarketMapResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMapResponse.market_map": - x.MarketMap = nil - case "slinky.mm2.v1.MarketMapResponse.last_updated": - x.LastUpdated = uint64(0) - case "slinky.mm2.v1.MarketMapResponse.chain_id": - x.ChainId = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapResponse 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_MarketMapResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MarketMapResponse.market_map": - value := x.MarketMap - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.mm2.v1.MarketMapResponse.last_updated": - value := x.LastUpdated - return protoreflect.ValueOfUint64(value) - case "slinky.mm2.v1.MarketMapResponse.chain_id": - value := x.ChainId - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapResponse 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_MarketMapResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMapResponse.market_map": - x.MarketMap = value.Message().Interface().(*MarketMap) - case "slinky.mm2.v1.MarketMapResponse.last_updated": - x.LastUpdated = value.Uint() - case "slinky.mm2.v1.MarketMapResponse.chain_id": - x.ChainId = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapResponse 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_MarketMapResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMapResponse.market_map": - if x.MarketMap == nil { - x.MarketMap = new(MarketMap) - } - return protoreflect.ValueOfMessage(x.MarketMap.ProtoReflect()) - case "slinky.mm2.v1.MarketMapResponse.last_updated": - panic(fmt.Errorf("field last_updated of message slinky.mm2.v1.MarketMapResponse is not mutable")) - case "slinky.mm2.v1.MarketMapResponse.chain_id": - panic(fmt.Errorf("field chain_id of message slinky.mm2.v1.MarketMapResponse is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapResponse 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_MarketMapResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketMapResponse.market_map": - m := new(MarketMap) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.mm2.v1.MarketMapResponse.last_updated": - return protoreflect.ValueOfUint64(uint64(0)) - case "slinky.mm2.v1.MarketMapResponse.chain_id": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketMapResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketMapResponse 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_MarketMapResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MarketMapResponse", 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_MarketMapResponse) 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_MarketMapResponse) 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_MarketMapResponse) 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_MarketMapResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MarketMapResponse) - 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.MarketMap != nil { - l = options.Size(x.MarketMap) - n += 1 + l + runtime.Sov(uint64(l)) - } - if x.LastUpdated != 0 { - n += 1 + runtime.Sov(uint64(x.LastUpdated)) - } - l = len(x.ChainId) - 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().(*MarketMapResponse) - 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.ChainId) > 0 { - i -= len(x.ChainId) - copy(dAtA[i:], x.ChainId) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ChainId))) - i-- - dAtA[i] = 0x1a - } - if x.LastUpdated != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.LastUpdated)) - i-- - dAtA[i] = 0x10 - } - if x.MarketMap != nil { - encoded, err := options.Marshal(x.MarketMap) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MarketMapResponse) - 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: MarketMapResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketMapResponse: 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 MarketMap", 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.MarketMap == nil { - x.MarketMap = &MarketMap{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.MarketMap); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - x.LastUpdated = 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.LastUpdated |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ChainId", 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.ChainId = 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_MarketRequest protoreflect.MessageDescriptor - fd_MarketRequest_currency_pair protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_MarketRequest = File_slinky_mm2_v1_query_proto.Messages().ByName("MarketRequest") - fd_MarketRequest_currency_pair = md_MarketRequest.Fields().ByName("currency_pair") -} - -var _ protoreflect.Message = (*fastReflection_MarketRequest)(nil) - -type fastReflection_MarketRequest MarketRequest - -func (x *MarketRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_MarketRequest)(x) -} - -func (x *MarketRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_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_MarketRequest_messageType fastReflection_MarketRequest_messageType -var _ protoreflect.MessageType = fastReflection_MarketRequest_messageType{} - -type fastReflection_MarketRequest_messageType struct{} - -func (x fastReflection_MarketRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_MarketRequest)(nil) -} -func (x fastReflection_MarketRequest_messageType) New() protoreflect.Message { - return new(fastReflection_MarketRequest) -} -func (x fastReflection_MarketRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MarketRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MarketRequest) Descriptor() protoreflect.MessageDescriptor { - return md_MarketRequest -} - -// 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_MarketRequest) Type() protoreflect.MessageType { - return _fastReflection_MarketRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MarketRequest) New() protoreflect.Message { - return new(fastReflection_MarketRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MarketRequest) Interface() protoreflect.ProtoMessage { - return (*MarketRequest)(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_MarketRequest) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.CurrencyPair != nil { - value := protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - if !f(fd_MarketRequest_currency_pair, 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_MarketRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MarketRequest.currency_pair": - return x.CurrencyPair != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketRequest 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_MarketRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketRequest.currency_pair": - x.CurrencyPair = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketRequest 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_MarketRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MarketRequest.currency_pair": - value := x.CurrencyPair - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketRequest 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_MarketRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketRequest.currency_pair": - x.CurrencyPair = value.Message().Interface().(*v1.CurrencyPair) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketRequest 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_MarketRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketRequest.currency_pair": - if x.CurrencyPair == nil { - x.CurrencyPair = new(v1.CurrencyPair) - } - return protoreflect.ValueOfMessage(x.CurrencyPair.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketRequest 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_MarketRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketRequest.currency_pair": - m := new(v1.CurrencyPair) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketRequest 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_MarketRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MarketRequest", 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_MarketRequest) 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_MarketRequest) 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_MarketRequest) 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_MarketRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MarketRequest) - 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.CurrencyPair != nil { - l = options.Size(x.CurrencyPair) - 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().(*MarketRequest) - 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.CurrencyPair != nil { - encoded, err := options.Marshal(x.CurrencyPair) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x1a - } - if 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().(*MarketRequest) - 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: MarketRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 3: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", 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.CurrencyPair == nil { - x.CurrencyPair = &v1.CurrencyPair{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CurrencyPair); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MarketResponse protoreflect.MessageDescriptor - fd_MarketResponse_market protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_MarketResponse = File_slinky_mm2_v1_query_proto.Messages().ByName("MarketResponse") - fd_MarketResponse_market = md_MarketResponse.Fields().ByName("market") -} - -var _ protoreflect.Message = (*fastReflection_MarketResponse)(nil) - -type fastReflection_MarketResponse MarketResponse - -func (x *MarketResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MarketResponse)(x) -} - -func (x *MarketResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_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_MarketResponse_messageType fastReflection_MarketResponse_messageType -var _ protoreflect.MessageType = fastReflection_MarketResponse_messageType{} - -type fastReflection_MarketResponse_messageType struct{} - -func (x fastReflection_MarketResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MarketResponse)(nil) -} -func (x fastReflection_MarketResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MarketResponse) -} -func (x fastReflection_MarketResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MarketResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MarketResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MarketResponse -} - -// 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_MarketResponse) Type() protoreflect.MessageType { - return _fastReflection_MarketResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MarketResponse) New() protoreflect.Message { - return new(fastReflection_MarketResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MarketResponse) Interface() protoreflect.ProtoMessage { - return (*MarketResponse)(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_MarketResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Market != nil { - value := protoreflect.ValueOfMessage(x.Market.ProtoReflect()) - if !f(fd_MarketResponse_market, 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_MarketResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MarketResponse.market": - return x.Market != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketResponse 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_MarketResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketResponse.market": - x.Market = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketResponse 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_MarketResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MarketResponse.market": - value := x.Market - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketResponse 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_MarketResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MarketResponse.market": - x.Market = value.Message().Interface().(*Market) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketResponse 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_MarketResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketResponse.market": - if x.Market == nil { - x.Market = new(Market) - } - return protoreflect.ValueOfMessage(x.Market.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketResponse 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_MarketResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MarketResponse.market": - m := new(Market) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MarketResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MarketResponse 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_MarketResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MarketResponse", 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_MarketResponse) 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_MarketResponse) 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_MarketResponse) 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_MarketResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MarketResponse) - 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.Market != nil { - l = options.Size(x.Market) - 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().(*MarketResponse) - 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.Market != nil { - encoded, err := options.Marshal(x.Market) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MarketResponse) - 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: MarketResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MarketResponse: 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 Market", 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.Market == nil { - x.Market = &Market{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Market); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_ParamsRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_ParamsRequest = File_slinky_mm2_v1_query_proto.Messages().ByName("ParamsRequest") -} - -var _ protoreflect.Message = (*fastReflection_ParamsRequest)(nil) - -type fastReflection_ParamsRequest ParamsRequest - -func (x *ParamsRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsRequest)(x) -} - -func (x *ParamsRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[4] - 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_ParamsRequest_messageType fastReflection_ParamsRequest_messageType -var _ protoreflect.MessageType = fastReflection_ParamsRequest_messageType{} - -type fastReflection_ParamsRequest_messageType struct{} - -func (x fastReflection_ParamsRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsRequest)(nil) -} -func (x fastReflection_ParamsRequest_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} -func (x fastReflection_ParamsRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsRequest) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsRequest -} - -// 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_ParamsRequest) Type() protoreflect.MessageType { - return _fastReflection_ParamsRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsRequest) New() protoreflect.Message { - return new(fastReflection_ParamsRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsRequest) Interface() protoreflect.ProtoMessage { - return (*ParamsRequest)(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_ParamsRequest) 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_ParamsRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsRequest 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_ParamsRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsRequest 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_ParamsRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsRequest 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_ParamsRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsRequest 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_ParamsRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsRequest 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_ParamsRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsRequest 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_ParamsRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.ParamsRequest", 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_ParamsRequest) 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_ParamsRequest) 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_ParamsRequest) 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_ParamsRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsRequest) - 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().(*ParamsRequest) - 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().(*ParamsRequest) - 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: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsRequest: 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, - } -} - -var ( - md_ParamsResponse protoreflect.MessageDescriptor - fd_ParamsResponse_params protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_ParamsResponse = File_slinky_mm2_v1_query_proto.Messages().ByName("ParamsResponse") - fd_ParamsResponse_params = md_ParamsResponse.Fields().ByName("params") -} - -var _ protoreflect.Message = (*fastReflection_ParamsResponse)(nil) - -type fastReflection_ParamsResponse ParamsResponse - -func (x *ParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_ParamsResponse)(x) -} - -func (x *ParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[5] - 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_ParamsResponse_messageType fastReflection_ParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_ParamsResponse_messageType{} - -type fastReflection_ParamsResponse_messageType struct{} - -func (x fastReflection_ParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_ParamsResponse)(nil) -} -func (x fastReflection_ParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} -func (x fastReflection_ParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_ParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_ParamsResponse -} - -// 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_ParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_ParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_ParamsResponse) New() protoreflect.Message { - return new(fastReflection_ParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_ParamsResponse) Interface() protoreflect.ProtoMessage { - return (*ParamsResponse)(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_ParamsResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_ParamsResponse_params, 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_ParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.ParamsResponse.params": - return x.Params != nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsResponse 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_ParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.ParamsResponse.params": - x.Params = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsResponse 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_ParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.ParamsResponse.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsResponse 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_ParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.ParamsResponse.params": - x.Params = value.Message().Interface().(*Params) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsResponse 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_ParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.ParamsResponse.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsResponse 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_ParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.ParamsResponse.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.ParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.ParamsResponse 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_ParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.ParamsResponse", 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_ParamsResponse) 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_ParamsResponse) 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_ParamsResponse) 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_ParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*ParamsResponse) - 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.Params != nil { - l = options.Size(x.Params) - 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().(*ParamsResponse) - 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.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*ParamsResponse) - 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: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: ParamsResponse: 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 Params", 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.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_LastUpdatedRequest protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_LastUpdatedRequest = File_slinky_mm2_v1_query_proto.Messages().ByName("LastUpdatedRequest") -} - -var _ protoreflect.Message = (*fastReflection_LastUpdatedRequest)(nil) - -type fastReflection_LastUpdatedRequest LastUpdatedRequest - -func (x *LastUpdatedRequest) ProtoReflect() protoreflect.Message { - return (*fastReflection_LastUpdatedRequest)(x) -} - -func (x *LastUpdatedRequest) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_LastUpdatedRequest_messageType fastReflection_LastUpdatedRequest_messageType -var _ protoreflect.MessageType = fastReflection_LastUpdatedRequest_messageType{} - -type fastReflection_LastUpdatedRequest_messageType struct{} - -func (x fastReflection_LastUpdatedRequest_messageType) Zero() protoreflect.Message { - return (*fastReflection_LastUpdatedRequest)(nil) -} -func (x fastReflection_LastUpdatedRequest_messageType) New() protoreflect.Message { - return new(fastReflection_LastUpdatedRequest) -} -func (x fastReflection_LastUpdatedRequest_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_LastUpdatedRequest -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_LastUpdatedRequest) Descriptor() protoreflect.MessageDescriptor { - return md_LastUpdatedRequest -} - -// 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_LastUpdatedRequest) Type() protoreflect.MessageType { - return _fastReflection_LastUpdatedRequest_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_LastUpdatedRequest) New() protoreflect.Message { - return new(fastReflection_LastUpdatedRequest) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_LastUpdatedRequest) Interface() protoreflect.ProtoMessage { - return (*LastUpdatedRequest)(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_LastUpdatedRequest) 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_LastUpdatedRequest) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedRequest 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_LastUpdatedRequest) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedRequest 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_LastUpdatedRequest) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedRequest 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_LastUpdatedRequest) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedRequest 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_LastUpdatedRequest) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedRequest 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_LastUpdatedRequest) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedRequest")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedRequest 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_LastUpdatedRequest) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.LastUpdatedRequest", 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_LastUpdatedRequest) 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_LastUpdatedRequest) 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_LastUpdatedRequest) 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_LastUpdatedRequest) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*LastUpdatedRequest) - 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().(*LastUpdatedRequest) - 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().(*LastUpdatedRequest) - 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: LastUpdatedRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LastUpdatedRequest: 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, - } -} - -var ( - md_LastUpdatedResponse protoreflect.MessageDescriptor - fd_LastUpdatedResponse_last_updated protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_query_proto_init() - md_LastUpdatedResponse = File_slinky_mm2_v1_query_proto.Messages().ByName("LastUpdatedResponse") - fd_LastUpdatedResponse_last_updated = md_LastUpdatedResponse.Fields().ByName("last_updated") -} - -var _ protoreflect.Message = (*fastReflection_LastUpdatedResponse)(nil) - -type fastReflection_LastUpdatedResponse LastUpdatedResponse - -func (x *LastUpdatedResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_LastUpdatedResponse)(x) -} - -func (x *LastUpdatedResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_LastUpdatedResponse_messageType fastReflection_LastUpdatedResponse_messageType -var _ protoreflect.MessageType = fastReflection_LastUpdatedResponse_messageType{} - -type fastReflection_LastUpdatedResponse_messageType struct{} - -func (x fastReflection_LastUpdatedResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_LastUpdatedResponse)(nil) -} -func (x fastReflection_LastUpdatedResponse_messageType) New() protoreflect.Message { - return new(fastReflection_LastUpdatedResponse) -} -func (x fastReflection_LastUpdatedResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_LastUpdatedResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_LastUpdatedResponse) Descriptor() protoreflect.MessageDescriptor { - return md_LastUpdatedResponse -} - -// 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_LastUpdatedResponse) Type() protoreflect.MessageType { - return _fastReflection_LastUpdatedResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_LastUpdatedResponse) New() protoreflect.Message { - return new(fastReflection_LastUpdatedResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_LastUpdatedResponse) Interface() protoreflect.ProtoMessage { - return (*LastUpdatedResponse)(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_LastUpdatedResponse) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.LastUpdated != uint64(0) { - value := protoreflect.ValueOfUint64(x.LastUpdated) - if !f(fd_LastUpdatedResponse_last_updated, 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_LastUpdatedResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.LastUpdatedResponse.last_updated": - return x.LastUpdated != uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedResponse 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_LastUpdatedResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.LastUpdatedResponse.last_updated": - x.LastUpdated = uint64(0) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedResponse 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_LastUpdatedResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.LastUpdatedResponse.last_updated": - value := x.LastUpdated - return protoreflect.ValueOfUint64(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedResponse 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_LastUpdatedResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.LastUpdatedResponse.last_updated": - x.LastUpdated = value.Uint() - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedResponse 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_LastUpdatedResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.LastUpdatedResponse.last_updated": - panic(fmt.Errorf("field last_updated of message slinky.mm2.v1.LastUpdatedResponse is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedResponse 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_LastUpdatedResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.LastUpdatedResponse.last_updated": - return protoreflect.ValueOfUint64(uint64(0)) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.LastUpdatedResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.LastUpdatedResponse 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_LastUpdatedResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.LastUpdatedResponse", 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_LastUpdatedResponse) 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_LastUpdatedResponse) 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_LastUpdatedResponse) 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_LastUpdatedResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*LastUpdatedResponse) - 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.LastUpdated != 0 { - n += 1 + runtime.Sov(uint64(x.LastUpdated)) - } - 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().(*LastUpdatedResponse) - 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.LastUpdated != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.LastUpdated)) - i-- - dAtA[i] = 0x8 - } - 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().(*LastUpdatedResponse) - 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: LastUpdatedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LastUpdatedResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - x.LastUpdated = 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.LastUpdated |= 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: slinky/mm2/v1/query.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) -) - -// MarketMapRequest is the query request for the MarketMap query. -// It takes no arguments. -type MarketMapRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MarketMapRequest) Reset() { - *x = MarketMapRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MarketMapRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MarketMapRequest) ProtoMessage() {} - -// Deprecated: Use MarketMapRequest.ProtoReflect.Descriptor instead. -func (*MarketMapRequest) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{0} -} - -// MarketMapResponse is the query response for the MarketMap query. -type MarketMapResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // MarketMap defines the global set of market configurations for all providers - // and markets. - MarketMap *MarketMap `protobuf:"bytes,1,opt,name=market_map,json=marketMap,proto3" json:"market_map,omitempty"` - // LastUpdated is the last block height that the market map was updated. - // This field can be used as an optimization for clients checking if there - // is a new update to the map. - LastUpdated uint64 `protobuf:"varint,2,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - // ChainId is the chain identifier for the market map. - ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (x *MarketMapResponse) Reset() { - *x = MarketMapResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MarketMapResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MarketMapResponse) ProtoMessage() {} - -// Deprecated: Use MarketMapResponse.ProtoReflect.Descriptor instead. -func (*MarketMapResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{1} -} - -func (x *MarketMapResponse) GetMarketMap() *MarketMap { - if x != nil { - return x.MarketMap - } - return nil -} - -func (x *MarketMapResponse) GetLastUpdated() uint64 { - if x != nil { - return x.LastUpdated - } - return 0 -} - -func (x *MarketMapResponse) GetChainId() string { - if x != nil { - return x.ChainId - } - return "" -} - -// MarketRequest is the query request for the Market query. -// It takes the currency pair of the market as an argument. -type MarketRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // CurrencyPair is the currency pair associated with the market being - // requested. - CurrencyPair *v1.CurrencyPair `protobuf:"bytes,3,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair,omitempty"` -} - -func (x *MarketRequest) Reset() { - *x = MarketRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MarketRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MarketRequest) ProtoMessage() {} - -// Deprecated: Use MarketRequest.ProtoReflect.Descriptor instead. -func (*MarketRequest) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{2} -} - -func (x *MarketRequest) GetCurrencyPair() *v1.CurrencyPair { - if x != nil { - return x.CurrencyPair - } - return nil -} - -// MarketResponse is the query response for the Market query. -type MarketResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Market is the configuration of a single market to be price-fetched for. - Market *Market `protobuf:"bytes,1,opt,name=market,proto3" json:"market,omitempty"` -} - -func (x *MarketResponse) Reset() { - *x = MarketResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MarketResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MarketResponse) ProtoMessage() {} - -// Deprecated: Use MarketResponse.ProtoReflect.Descriptor instead. -func (*MarketResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{3} -} - -func (x *MarketResponse) GetMarket() *Market { - if x != nil { - return x.Market - } - return nil -} - -// ParamsRequest is the request type for the Query/Params RPC method. -type ParamsRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *ParamsRequest) Reset() { - *x = ParamsRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsRequest) ProtoMessage() {} - -// Deprecated: Use ParamsRequest.ProtoReflect.Descriptor instead. -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{4} -} - -// ParamsResponse is the response type for the Query/Params RPC method. -type ParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` -} - -func (x *ParamsResponse) Reset() { - *x = ParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *ParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*ParamsResponse) ProtoMessage() {} - -// Deprecated: Use ParamsResponse.ProtoReflect.Descriptor instead. -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{5} -} - -func (x *ParamsResponse) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -// LastUpdatedRequest is the request type for the Query/LastUpdated RPC -// method. -type LastUpdatedRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *LastUpdatedRequest) Reset() { - *x = LastUpdatedRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LastUpdatedRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LastUpdatedRequest) ProtoMessage() {} - -// Deprecated: Use LastUpdatedRequest.ProtoReflect.Descriptor instead. -func (*LastUpdatedRequest) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{6} -} - -// LastUpdatedResponse is the response type for the Query/LastUpdated RPC -// method. -type LastUpdatedResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - LastUpdated uint64 `protobuf:"varint,1,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` -} - -func (x *LastUpdatedResponse) Reset() { - *x = LastUpdatedResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_query_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *LastUpdatedResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*LastUpdatedResponse) ProtoMessage() {} - -// Deprecated: Use LastUpdatedResponse.ProtoReflect.Descriptor instead. -func (*LastUpdatedResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_query_proto_rawDescGZIP(), []int{7} -} - -func (x *LastUpdatedResponse) GetLastUpdated() uint64 { - if x != nil { - return x.LastUpdated - } - return 0 -} - -var File_slinky_mm2_v1_query_proto protoreflect.FileDescriptor - -var file_slinky_mm2_v1_query_proto_rawDesc = []byte{ - 0x0a, 0x19, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, - 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, - 0x6f, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x23, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2f, 0x76, 0x31, 0x2f, - 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x1a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, - 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, - 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x70, - 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x12, 0x0a, 0x10, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, - 0x90, 0x01, 0x0a, 0x11, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3d, 0x0a, 0x0a, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x5f, - 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x4d, 0x61, 0x70, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x6d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x4d, 0x61, 0x70, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x73, 0x74, 0x5f, 0x75, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x0b, 0x6c, 0x61, 0x73, 0x74, - 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x19, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x5f, 0x69, 0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, - 0x49, 0x64, 0x22, 0x59, 0x0a, 0x0d, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, - 0x65, 0x73, 0x74, 0x12, 0x48, 0x0a, 0x0d, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, - 0x70, 0x61, 0x69, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1d, 0x2e, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x76, 0x31, 0x2e, 0x43, 0x75, 0x72, - 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x0c, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x22, 0x45, 0x0a, - 0x0e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x33, 0x0a, 0x06, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x6d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x22, 0x0f, 0x0a, 0x0d, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x45, 0x0a, 0x0e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x33, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, - 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x14, 0x0a, 0x12, - 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x22, 0x38, 0x0a, 0x13, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x6c, 0x61, 0x73, - 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x0b, 0x6c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x32, 0xc0, 0x03, 0x0a, - 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x70, 0x0a, 0x09, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x4d, 0x61, 0x70, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, - 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x4d, 0x61, 0x70, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x20, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1a, 0x12, 0x18, - 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x12, 0x64, 0x0a, 0x06, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x12, 0x1c, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, - 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, - 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x12, 0x79, - 0x0a, 0x0b, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x21, 0x2e, - 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4c, 0x61, - 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x22, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, - 0x2e, 0x4c, 0x61, 0x73, 0x74, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x23, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1d, 0x12, 0x1b, 0x2f, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x6c, 0x61, 0x73, - 0x74, 0x5f, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x12, 0x64, 0x0a, 0x06, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x1c, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, - 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, - 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, - 0x31, 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x1d, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x17, 0x12, 0x15, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, - 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, - 0x9b, 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, - 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, - 0x6f, 0x50, 0x01, 0x5a, 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, - 0x6f, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, - 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6d, 0x32, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, - 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x6d, 0x32, 0x2e, 0x56, 0x31, 0xca, - 0x02, 0x0d, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x56, 0x31, 0xe2, - 0x02, 0x19, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x56, 0x31, 0x5c, - 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x3a, 0x3a, 0x4d, 0x6d, 0x32, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, - 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_slinky_mm2_v1_query_proto_rawDescOnce sync.Once - file_slinky_mm2_v1_query_proto_rawDescData = file_slinky_mm2_v1_query_proto_rawDesc -) - -func file_slinky_mm2_v1_query_proto_rawDescGZIP() []byte { - file_slinky_mm2_v1_query_proto_rawDescOnce.Do(func() { - file_slinky_mm2_v1_query_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_mm2_v1_query_proto_rawDescData) - }) - return file_slinky_mm2_v1_query_proto_rawDescData -} - -var file_slinky_mm2_v1_query_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_slinky_mm2_v1_query_proto_goTypes = []interface{}{ - (*MarketMapRequest)(nil), // 0: slinky.mm2.v1.MarketMapRequest - (*MarketMapResponse)(nil), // 1: slinky.mm2.v1.MarketMapResponse - (*MarketRequest)(nil), // 2: slinky.mm2.v1.MarketRequest - (*MarketResponse)(nil), // 3: slinky.mm2.v1.MarketResponse - (*ParamsRequest)(nil), // 4: slinky.mm2.v1.ParamsRequest - (*ParamsResponse)(nil), // 5: slinky.mm2.v1.ParamsResponse - (*LastUpdatedRequest)(nil), // 6: slinky.mm2.v1.LastUpdatedRequest - (*LastUpdatedResponse)(nil), // 7: slinky.mm2.v1.LastUpdatedResponse - (*MarketMap)(nil), // 8: slinky.mm2.v1.MarketMap - (*v1.CurrencyPair)(nil), // 9: slinky.types.v1.CurrencyPair - (*Market)(nil), // 10: slinky.mm2.v1.Market - (*Params)(nil), // 11: slinky.mm2.v1.Params -} -var file_slinky_mm2_v1_query_proto_depIdxs = []int32{ - 8, // 0: slinky.mm2.v1.MarketMapResponse.market_map:type_name -> slinky.mm2.v1.MarketMap - 9, // 1: slinky.mm2.v1.MarketRequest.currency_pair:type_name -> slinky.types.v1.CurrencyPair - 10, // 2: slinky.mm2.v1.MarketResponse.market:type_name -> slinky.mm2.v1.Market - 11, // 3: slinky.mm2.v1.ParamsResponse.params:type_name -> slinky.mm2.v1.Params - 0, // 4: slinky.mm2.v1.Query.MarketMap:input_type -> slinky.mm2.v1.MarketMapRequest - 2, // 5: slinky.mm2.v1.Query.Market:input_type -> slinky.mm2.v1.MarketRequest - 6, // 6: slinky.mm2.v1.Query.LastUpdated:input_type -> slinky.mm2.v1.LastUpdatedRequest - 4, // 7: slinky.mm2.v1.Query.Params:input_type -> slinky.mm2.v1.ParamsRequest - 1, // 8: slinky.mm2.v1.Query.MarketMap:output_type -> slinky.mm2.v1.MarketMapResponse - 3, // 9: slinky.mm2.v1.Query.Market:output_type -> slinky.mm2.v1.MarketResponse - 7, // 10: slinky.mm2.v1.Query.LastUpdated:output_type -> slinky.mm2.v1.LastUpdatedResponse - 5, // 11: slinky.mm2.v1.Query.Params:output_type -> slinky.mm2.v1.ParamsResponse - 8, // [8:12] is the sub-list for method output_type - 4, // [4:8] is the sub-list for method input_type - 4, // [4:4] is the sub-list for extension type_name - 4, // [4:4] is the sub-list for extension extendee - 0, // [0:4] is the sub-list for field type_name -} - -func init() { file_slinky_mm2_v1_query_proto_init() } -func file_slinky_mm2_v1_query_proto_init() { - if File_slinky_mm2_v1_query_proto != nil { - return - } - file_slinky_mm2_v1_market_proto_init() - file_slinky_mm2_v1_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_mm2_v1_query_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarketMapRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarketMapResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarketRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MarketResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*ParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LastUpdatedRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_query_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*LastUpdatedResponse); 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_slinky_mm2_v1_query_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_mm2_v1_query_proto_goTypes, - DependencyIndexes: file_slinky_mm2_v1_query_proto_depIdxs, - MessageInfos: file_slinky_mm2_v1_query_proto_msgTypes, - }.Build() - File_slinky_mm2_v1_query_proto = out.File - file_slinky_mm2_v1_query_proto_rawDesc = nil - file_slinky_mm2_v1_query_proto_goTypes = nil - file_slinky_mm2_v1_query_proto_depIdxs = nil -} diff --git a/api/slinky/mm2/v1/query_grpc.pb.go b/api/slinky/mm2/v1/query_grpc.pb.go deleted file mode 100644 index 38f2d9762..000000000 --- a/api/slinky/mm2/v1/query_grpc.pb.go +++ /dev/null @@ -1,232 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: slinky/mm2/v1/query.proto - -package mm2v1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Query_MarketMap_FullMethodName = "/slinky.mm2.v1.Query/MarketMap" - Query_Market_FullMethodName = "/slinky.mm2.v1.Query/Market" - Query_LastUpdated_FullMethodName = "/slinky.mm2.v1.Query/LastUpdated" - Query_Params_FullMethodName = "/slinky.mm2.v1.Query/Params" -) - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type QueryClient interface { - // MarketMap returns the full market map stored in the x/marketmap - // module. - MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) - // Market returns a market stored in the x/marketmap - // module. - Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) - // LastUpdated returns the last height the market map was updated at. - LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) - // Params returns the current x/marketmap module parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryClient struct { - cc grpc.ClientConnInterface -} - -func NewQueryClient(cc grpc.ClientConnInterface) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) { - out := new(MarketMapResponse) - err := c.cc.Invoke(ctx, Query_MarketMap_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) { - out := new(MarketResponse) - err := c.cc.Invoke(ctx, Query_Market_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) { - out := new(LastUpdatedResponse) - err := c.cc.Invoke(ctx, Query_LastUpdated_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -// All implementations must embed UnimplementedQueryServer -// for forward compatibility -type QueryServer interface { - // MarketMap returns the full market map stored in the x/marketmap - // module. - MarketMap(context.Context, *MarketMapRequest) (*MarketMapResponse, error) - // Market returns a market stored in the x/marketmap - // module. - Market(context.Context, *MarketRequest) (*MarketResponse, error) - // LastUpdated returns the last height the market map was updated at. - LastUpdated(context.Context, *LastUpdatedRequest) (*LastUpdatedResponse, error) - // Params returns the current x/marketmap module parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) - mustEmbedUnimplementedQueryServer() -} - -// UnimplementedQueryServer must be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (UnimplementedQueryServer) MarketMap(context.Context, *MarketMapRequest) (*MarketMapResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MarketMap not implemented") -} -func (UnimplementedQueryServer) Market(context.Context, *MarketRequest) (*MarketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Market not implemented") -} -func (UnimplementedQueryServer) LastUpdated(context.Context, *LastUpdatedRequest) (*LastUpdatedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LastUpdated not implemented") -} -func (UnimplementedQueryServer) Params(context.Context, *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {} - -// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to QueryServer will -// result in compilation errors. -type UnsafeQueryServer interface { - mustEmbedUnimplementedQueryServer() -} - -func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) { - s.RegisterService(&Query_ServiceDesc, srv) -} - -func _Query_MarketMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MarketMapRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).MarketMap(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_MarketMap_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MarketMap(ctx, req.(*MarketMapRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Market_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MarketRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Market(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_Market_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Market(ctx, req.(*MarketRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_LastUpdated_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LastUpdatedRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).LastUpdated(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_LastUpdated_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastUpdated(ctx, req.(*LastUpdatedRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Query_Params_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -// Query_ServiceDesc is the grpc.ServiceDesc for Query service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var Query_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.mm2.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "MarketMap", - Handler: _Query_MarketMap_Handler, - }, - { - MethodName: "Market", - Handler: _Query_Market_Handler, - }, - { - MethodName: "LastUpdated", - Handler: _Query_LastUpdated_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/mm2/v1/query.proto", -} diff --git a/api/slinky/mm2/v1/tx.pulsar.go b/api/slinky/mm2/v1/tx.pulsar.go deleted file mode 100644 index 181ba38bc..000000000 --- a/api/slinky/mm2/v1/tx.pulsar.go +++ /dev/null @@ -1,4188 +0,0 @@ -// Code generated by protoc-gen-go-pulsar. DO NOT EDIT. -package mm2v1 - -import ( - _ "cosmossdk.io/api/amino" - _ "cosmossdk.io/api/cosmos/msg/v1" - 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 = (*_MsgCreateMarkets_2_list)(nil) - -type _MsgCreateMarkets_2_list struct { - list *[]*Market -} - -func (x *_MsgCreateMarkets_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgCreateMarkets_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgCreateMarkets_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Market) - (*x.list)[i] = concreteValue -} - -func (x *_MsgCreateMarkets_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Market) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgCreateMarkets_2_list) AppendMutable() protoreflect.Value { - v := new(Market) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreateMarkets_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgCreateMarkets_2_list) NewElement() protoreflect.Value { - v := new(Market) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgCreateMarkets_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgCreateMarkets protoreflect.MessageDescriptor - fd_MsgCreateMarkets_authority protoreflect.FieldDescriptor - fd_MsgCreateMarkets_create_markets protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgCreateMarkets = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgCreateMarkets") - fd_MsgCreateMarkets_authority = md_MsgCreateMarkets.Fields().ByName("authority") - fd_MsgCreateMarkets_create_markets = md_MsgCreateMarkets.Fields().ByName("create_markets") -} - -var _ protoreflect.Message = (*fastReflection_MsgCreateMarkets)(nil) - -type fastReflection_MsgCreateMarkets MsgCreateMarkets - -func (x *MsgCreateMarkets) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreateMarkets)(x) -} - -func (x *MsgCreateMarkets) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_tx_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_MsgCreateMarkets_messageType fastReflection_MsgCreateMarkets_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreateMarkets_messageType{} - -type fastReflection_MsgCreateMarkets_messageType struct{} - -func (x fastReflection_MsgCreateMarkets_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreateMarkets)(nil) -} -func (x fastReflection_MsgCreateMarkets_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreateMarkets) -} -func (x fastReflection_MsgCreateMarkets_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreateMarkets -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgCreateMarkets) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreateMarkets -} - -// 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_MsgCreateMarkets) Type() protoreflect.MessageType { - return _fastReflection_MsgCreateMarkets_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreateMarkets) New() protoreflect.Message { - return new(fastReflection_MsgCreateMarkets) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreateMarkets) Interface() protoreflect.ProtoMessage { - return (*MsgCreateMarkets)(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_MsgCreateMarkets) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgCreateMarkets_authority, value) { - return - } - } - if len(x.CreateMarkets) != 0 { - value := protoreflect.ValueOfList(&_MsgCreateMarkets_2_list{list: &x.CreateMarkets}) - if !f(fd_MsgCreateMarkets_create_markets, 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_MsgCreateMarkets) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MsgCreateMarkets.authority": - return x.Authority != "" - case "slinky.mm2.v1.MsgCreateMarkets.create_markets": - return len(x.CreateMarkets) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarkets 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_MsgCreateMarkets) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgCreateMarkets.authority": - x.Authority = "" - case "slinky.mm2.v1.MsgCreateMarkets.create_markets": - x.CreateMarkets = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarkets 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_MsgCreateMarkets) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MsgCreateMarkets.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - case "slinky.mm2.v1.MsgCreateMarkets.create_markets": - if len(x.CreateMarkets) == 0 { - return protoreflect.ValueOfList(&_MsgCreateMarkets_2_list{}) - } - listValue := &_MsgCreateMarkets_2_list{list: &x.CreateMarkets} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarkets 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_MsgCreateMarkets) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgCreateMarkets.authority": - x.Authority = value.Interface().(string) - case "slinky.mm2.v1.MsgCreateMarkets.create_markets": - lv := value.List() - clv := lv.(*_MsgCreateMarkets_2_list) - x.CreateMarkets = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarkets 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_MsgCreateMarkets) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgCreateMarkets.create_markets": - if x.CreateMarkets == nil { - x.CreateMarkets = []*Market{} - } - value := &_MsgCreateMarkets_2_list{list: &x.CreateMarkets} - return protoreflect.ValueOfList(value) - case "slinky.mm2.v1.MsgCreateMarkets.authority": - panic(fmt.Errorf("field authority of message slinky.mm2.v1.MsgCreateMarkets is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarkets 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_MsgCreateMarkets) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgCreateMarkets.authority": - return protoreflect.ValueOfString("") - case "slinky.mm2.v1.MsgCreateMarkets.create_markets": - list := []*Market{} - return protoreflect.ValueOfList(&_MsgCreateMarkets_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarkets 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_MsgCreateMarkets) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgCreateMarkets", 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_MsgCreateMarkets) 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_MsgCreateMarkets) 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_MsgCreateMarkets) 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_MsgCreateMarkets) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreateMarkets) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.CreateMarkets) > 0 { - for _, e := range x.CreateMarkets { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgCreateMarkets) - 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.CreateMarkets) > 0 { - for iNdEx := len(x.CreateMarkets) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.CreateMarkets[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgCreateMarkets) - 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: MsgCreateMarkets: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field CreateMarkets", 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.CreateMarkets = append(x.CreateMarkets, &Market{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.CreateMarkets[len(x.CreateMarkets)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgCreateMarketsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgCreateMarketsResponse = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgCreateMarketsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgCreateMarketsResponse)(nil) - -type fastReflection_MsgCreateMarketsResponse MsgCreateMarketsResponse - -func (x *MsgCreateMarketsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgCreateMarketsResponse)(x) -} - -func (x *MsgCreateMarketsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_tx_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_MsgCreateMarketsResponse_messageType fastReflection_MsgCreateMarketsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgCreateMarketsResponse_messageType{} - -type fastReflection_MsgCreateMarketsResponse_messageType struct{} - -func (x fastReflection_MsgCreateMarketsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgCreateMarketsResponse)(nil) -} -func (x fastReflection_MsgCreateMarketsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgCreateMarketsResponse) -} -func (x fastReflection_MsgCreateMarketsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreateMarketsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgCreateMarketsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgCreateMarketsResponse -} - -// 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_MsgCreateMarketsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgCreateMarketsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgCreateMarketsResponse) New() protoreflect.Message { - return new(fastReflection_MsgCreateMarketsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgCreateMarketsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgCreateMarketsResponse)(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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgCreateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgCreateMarketsResponse 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_MsgCreateMarketsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgCreateMarketsResponse", 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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) 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_MsgCreateMarketsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgCreateMarketsResponse) - 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().(*MsgCreateMarketsResponse) - 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().(*MsgCreateMarketsResponse) - 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: MsgCreateMarketsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgCreateMarketsResponse: 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, - } -} - -var _ protoreflect.List = (*_MsgUpdateMarkets_2_list)(nil) - -type _MsgUpdateMarkets_2_list struct { - list *[]*Market -} - -func (x *_MsgUpdateMarkets_2_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgUpdateMarkets_2_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfMessage((*x.list)[i].ProtoReflect()) -} - -func (x *_MsgUpdateMarkets_2_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Market) - (*x.list)[i] = concreteValue -} - -func (x *_MsgUpdateMarkets_2_list) Append(value protoreflect.Value) { - valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*Market) - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgUpdateMarkets_2_list) AppendMutable() protoreflect.Value { - v := new(Market) - *x.list = append(*x.list, v) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgUpdateMarkets_2_list) Truncate(n int) { - for i := n; i < len(*x.list); i++ { - (*x.list)[i] = nil - } - *x.list = (*x.list)[:n] -} - -func (x *_MsgUpdateMarkets_2_list) NewElement() protoreflect.Value { - v := new(Market) - return protoreflect.ValueOfMessage(v.ProtoReflect()) -} - -func (x *_MsgUpdateMarkets_2_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgUpdateMarkets protoreflect.MessageDescriptor - fd_MsgUpdateMarkets_authority protoreflect.FieldDescriptor - fd_MsgUpdateMarkets_update_markets protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgUpdateMarkets = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgUpdateMarkets") - fd_MsgUpdateMarkets_authority = md_MsgUpdateMarkets.Fields().ByName("authority") - fd_MsgUpdateMarkets_update_markets = md_MsgUpdateMarkets.Fields().ByName("update_markets") -} - -var _ protoreflect.Message = (*fastReflection_MsgUpdateMarkets)(nil) - -type fastReflection_MsgUpdateMarkets MsgUpdateMarkets - -func (x *MsgUpdateMarkets) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateMarkets)(x) -} - -func (x *MsgUpdateMarkets) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_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_MsgUpdateMarkets_messageType fastReflection_MsgUpdateMarkets_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateMarkets_messageType{} - -type fastReflection_MsgUpdateMarkets_messageType struct{} - -func (x fastReflection_MsgUpdateMarkets_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateMarkets)(nil) -} -func (x fastReflection_MsgUpdateMarkets_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarkets) -} -func (x fastReflection_MsgUpdateMarkets_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarkets -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUpdateMarkets) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarkets -} - -// 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_MsgUpdateMarkets) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateMarkets_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateMarkets) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarkets) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateMarkets) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateMarkets)(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_MsgUpdateMarkets) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgUpdateMarkets_authority, value) { - return - } - } - if len(x.UpdateMarkets) != 0 { - value := protoreflect.ValueOfList(&_MsgUpdateMarkets_2_list{list: &x.UpdateMarkets}) - if !f(fd_MsgUpdateMarkets_update_markets, 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_MsgUpdateMarkets) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MsgUpdateMarkets.authority": - return x.Authority != "" - case "slinky.mm2.v1.MsgUpdateMarkets.update_markets": - return len(x.UpdateMarkets) != 0 - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgUpdateMarkets.authority": - x.Authority = "" - case "slinky.mm2.v1.MsgUpdateMarkets.update_markets": - x.UpdateMarkets = nil - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MsgUpdateMarkets.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - case "slinky.mm2.v1.MsgUpdateMarkets.update_markets": - if len(x.UpdateMarkets) == 0 { - return protoreflect.ValueOfList(&_MsgUpdateMarkets_2_list{}) - } - listValue := &_MsgUpdateMarkets_2_list{list: &x.UpdateMarkets} - return protoreflect.ValueOfList(listValue) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgUpdateMarkets.authority": - x.Authority = value.Interface().(string) - case "slinky.mm2.v1.MsgUpdateMarkets.update_markets": - lv := value.List() - clv := lv.(*_MsgUpdateMarkets_2_list) - x.UpdateMarkets = *clv.list - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgUpdateMarkets.update_markets": - if x.UpdateMarkets == nil { - x.UpdateMarkets = []*Market{} - } - value := &_MsgUpdateMarkets_2_list{list: &x.UpdateMarkets} - return protoreflect.ValueOfList(value) - case "slinky.mm2.v1.MsgUpdateMarkets.authority": - panic(fmt.Errorf("field authority of message slinky.mm2.v1.MsgUpdateMarkets is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgUpdateMarkets.authority": - return protoreflect.ValueOfString("") - case "slinky.mm2.v1.MsgUpdateMarkets.update_markets": - list := []*Market{} - return protoreflect.ValueOfList(&_MsgUpdateMarkets_2_list{list: &list}) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarkets")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarkets 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_MsgUpdateMarkets) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgUpdateMarkets", 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_MsgUpdateMarkets) 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_MsgUpdateMarkets) 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_MsgUpdateMarkets) 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_MsgUpdateMarkets) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateMarkets) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - l = len(x.Authority) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - if len(x.UpdateMarkets) > 0 { - for _, e := range x.UpdateMarkets { - l = options.Size(e) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - if x.unknownFields != nil { - n += len(x.unknownFields) - } - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: n, - } - } - - marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateMarkets) - 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.UpdateMarkets) > 0 { - for iNdEx := len(x.UpdateMarkets) - 1; iNdEx >= 0; iNdEx-- { - encoded, err := options.Marshal(x.UpdateMarkets[iNdEx]) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0x12 - } - } - if len(x.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgUpdateMarkets) - 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: MsgUpdateMarkets: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field UpdateMarkets", 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.UpdateMarkets = append(x.UpdateMarkets, &Market{}) - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.UpdateMarkets[len(x.UpdateMarkets)-1]); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -var ( - md_MsgUpdateMarketsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgUpdateMarketsResponse = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgUpdateMarketsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgUpdateMarketsResponse)(nil) - -type fastReflection_MsgUpdateMarketsResponse MsgUpdateMarketsResponse - -func (x *MsgUpdateMarketsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgUpdateMarketsResponse)(x) -} - -func (x *MsgUpdateMarketsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_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_MsgUpdateMarketsResponse_messageType fastReflection_MsgUpdateMarketsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgUpdateMarketsResponse_messageType{} - -type fastReflection_MsgUpdateMarketsResponse_messageType struct{} - -func (x fastReflection_MsgUpdateMarketsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgUpdateMarketsResponse)(nil) -} -func (x fastReflection_MsgUpdateMarketsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarketsResponse) -} -func (x fastReflection_MsgUpdateMarketsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarketsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgUpdateMarketsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgUpdateMarketsResponse -} - -// 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_MsgUpdateMarketsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgUpdateMarketsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgUpdateMarketsResponse) New() protoreflect.Message { - return new(fastReflection_MsgUpdateMarketsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgUpdateMarketsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgUpdateMarketsResponse)(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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgUpdateMarketsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgUpdateMarketsResponse 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_MsgUpdateMarketsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgUpdateMarketsResponse", 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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) 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_MsgUpdateMarketsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgUpdateMarketsResponse) - 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().(*MsgUpdateMarketsResponse) - 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().(*MsgUpdateMarketsResponse) - 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: MsgUpdateMarketsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgUpdateMarketsResponse: 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, - } -} - -var ( - md_MsgParams protoreflect.MessageDescriptor - fd_MsgParams_params protoreflect.FieldDescriptor - fd_MsgParams_authority protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgParams = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgParams") - fd_MsgParams_params = md_MsgParams.Fields().ByName("params") - fd_MsgParams_authority = md_MsgParams.Fields().ByName("authority") -} - -var _ protoreflect.Message = (*fastReflection_MsgParams)(nil) - -type fastReflection_MsgParams MsgParams - -func (x *MsgParams) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgParams)(x) -} - -func (x *MsgParams) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[4] - 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_MsgParams_messageType fastReflection_MsgParams_messageType -var _ protoreflect.MessageType = fastReflection_MsgParams_messageType{} - -type fastReflection_MsgParams_messageType struct{} - -func (x fastReflection_MsgParams_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgParams)(nil) -} -func (x fastReflection_MsgParams_messageType) New() protoreflect.Message { - return new(fastReflection_MsgParams) -} -func (x fastReflection_MsgParams_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParams -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgParams) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParams -} - -// 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_MsgParams) Type() protoreflect.MessageType { - return _fastReflection_MsgParams_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgParams) New() protoreflect.Message { - return new(fastReflection_MsgParams) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgParams) Interface() protoreflect.ProtoMessage { - return (*MsgParams)(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_MsgParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if x.Params != nil { - value := protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - if !f(fd_MsgParams_params, value) { - return - } - } - if x.Authority != "" { - value := protoreflect.ValueOfString(x.Authority) - if !f(fd_MsgParams_authority, 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_MsgParams) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MsgParams.params": - return x.Params != nil - case "slinky.mm2.v1.MsgParams.authority": - return x.Authority != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParams 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_MsgParams) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgParams.params": - x.Params = nil - case "slinky.mm2.v1.MsgParams.authority": - x.Authority = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParams 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_MsgParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MsgParams.params": - value := x.Params - return protoreflect.ValueOfMessage(value.ProtoReflect()) - case "slinky.mm2.v1.MsgParams.authority": - value := x.Authority - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParams 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_MsgParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgParams.params": - x.Params = value.Message().Interface().(*Params) - case "slinky.mm2.v1.MsgParams.authority": - x.Authority = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParams 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_MsgParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgParams.params": - if x.Params == nil { - x.Params = new(Params) - } - return protoreflect.ValueOfMessage(x.Params.ProtoReflect()) - case "slinky.mm2.v1.MsgParams.authority": - panic(fmt.Errorf("field authority of message slinky.mm2.v1.MsgParams is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParams 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_MsgParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgParams.params": - m := new(Params) - return protoreflect.ValueOfMessage(m.ProtoReflect()) - case "slinky.mm2.v1.MsgParams.authority": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParams")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParams 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_MsgParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgParams", 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_MsgParams) 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_MsgParams) 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_MsgParams) 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_MsgParams) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgParams) - 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.Params != nil { - l = options.Size(x.Params) - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.Authority) - 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().(*MsgParams) - 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.Authority) > 0 { - i -= len(x.Authority) - copy(dAtA[i:], x.Authority) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Authority))) - i-- - dAtA[i] = 0x12 - } - if x.Params != nil { - encoded, err := options.Marshal(x.Params) - if err != nil { - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, err - } - i -= len(encoded) - copy(dAtA[i:], encoded) - i = runtime.EncodeVarint(dAtA, i, uint64(len(encoded))) - i-- - dAtA[i] = 0xa - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgParams) - 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: MsgParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParams: 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 Params", 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.Params == nil { - x.Params = &Params{} - } - if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.Params); err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if postIndex > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - x.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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_MsgParamsResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgParamsResponse = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgParamsResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgParamsResponse)(nil) - -type fastReflection_MsgParamsResponse MsgParamsResponse - -func (x *MsgParamsResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgParamsResponse)(x) -} - -func (x *MsgParamsResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[5] - 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_MsgParamsResponse_messageType fastReflection_MsgParamsResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgParamsResponse_messageType{} - -type fastReflection_MsgParamsResponse_messageType struct{} - -func (x fastReflection_MsgParamsResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgParamsResponse)(nil) -} -func (x fastReflection_MsgParamsResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgParamsResponse) -} -func (x fastReflection_MsgParamsResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParamsResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgParamsResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgParamsResponse -} - -// 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_MsgParamsResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgParamsResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgParamsResponse) New() protoreflect.Message { - return new(fastReflection_MsgParamsResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgParamsResponse) Interface() protoreflect.ProtoMessage { - return (*MsgParamsResponse)(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_MsgParamsResponse) 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_MsgParamsResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParamsResponse 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_MsgParamsResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParamsResponse 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_MsgParamsResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParamsResponse 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_MsgParamsResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParamsResponse 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_MsgParamsResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParamsResponse 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_MsgParamsResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgParamsResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgParamsResponse 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_MsgParamsResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgParamsResponse", 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_MsgParamsResponse) 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_MsgParamsResponse) 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_MsgParamsResponse) 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_MsgParamsResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgParamsResponse) - 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().(*MsgParamsResponse) - 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().(*MsgParamsResponse) - 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: MsgParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgParamsResponse: 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, - } -} - -var _ protoreflect.List = (*_MsgRemoveMarketAuthorities_1_list)(nil) - -type _MsgRemoveMarketAuthorities_1_list struct { - list *[]string -} - -func (x *_MsgRemoveMarketAuthorities_1_list) Len() int { - if x.list == nil { - return 0 - } - return len(*x.list) -} - -func (x *_MsgRemoveMarketAuthorities_1_list) Get(i int) protoreflect.Value { - return protoreflect.ValueOfString((*x.list)[i]) -} - -func (x *_MsgRemoveMarketAuthorities_1_list) Set(i int, value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - (*x.list)[i] = concreteValue -} - -func (x *_MsgRemoveMarketAuthorities_1_list) Append(value protoreflect.Value) { - valueUnwrapped := value.String() - concreteValue := valueUnwrapped - *x.list = append(*x.list, concreteValue) -} - -func (x *_MsgRemoveMarketAuthorities_1_list) AppendMutable() protoreflect.Value { - panic(fmt.Errorf("AppendMutable can not be called on message MsgRemoveMarketAuthorities at list field RemoveAddresses as it is not of Message kind")) -} - -func (x *_MsgRemoveMarketAuthorities_1_list) Truncate(n int) { - *x.list = (*x.list)[:n] -} - -func (x *_MsgRemoveMarketAuthorities_1_list) NewElement() protoreflect.Value { - v := "" - return protoreflect.ValueOfString(v) -} - -func (x *_MsgRemoveMarketAuthorities_1_list) IsValid() bool { - return x.list != nil -} - -var ( - md_MsgRemoveMarketAuthorities protoreflect.MessageDescriptor - fd_MsgRemoveMarketAuthorities_remove_addresses protoreflect.FieldDescriptor - fd_MsgRemoveMarketAuthorities_admin protoreflect.FieldDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgRemoveMarketAuthorities = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgRemoveMarketAuthorities") - fd_MsgRemoveMarketAuthorities_remove_addresses = md_MsgRemoveMarketAuthorities.Fields().ByName("remove_addresses") - fd_MsgRemoveMarketAuthorities_admin = md_MsgRemoveMarketAuthorities.Fields().ByName("admin") -} - -var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketAuthorities)(nil) - -type fastReflection_MsgRemoveMarketAuthorities MsgRemoveMarketAuthorities - -func (x *MsgRemoveMarketAuthorities) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgRemoveMarketAuthorities)(x) -} - -func (x *MsgRemoveMarketAuthorities) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[6] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgRemoveMarketAuthorities_messageType fastReflection_MsgRemoveMarketAuthorities_messageType -var _ protoreflect.MessageType = fastReflection_MsgRemoveMarketAuthorities_messageType{} - -type fastReflection_MsgRemoveMarketAuthorities_messageType struct{} - -func (x fastReflection_MsgRemoveMarketAuthorities_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgRemoveMarketAuthorities)(nil) -} -func (x fastReflection_MsgRemoveMarketAuthorities_messageType) New() protoreflect.Message { - return new(fastReflection_MsgRemoveMarketAuthorities) -} -func (x fastReflection_MsgRemoveMarketAuthorities_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveMarketAuthorities -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgRemoveMarketAuthorities) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveMarketAuthorities -} - -// 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_MsgRemoveMarketAuthorities) Type() protoreflect.MessageType { - return _fastReflection_MsgRemoveMarketAuthorities_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgRemoveMarketAuthorities) New() protoreflect.Message { - return new(fastReflection_MsgRemoveMarketAuthorities) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgRemoveMarketAuthorities) Interface() protoreflect.ProtoMessage { - return (*MsgRemoveMarketAuthorities)(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_MsgRemoveMarketAuthorities) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { - if len(x.RemoveAddresses) != 0 { - value := protoreflect.ValueOfList(&_MsgRemoveMarketAuthorities_1_list{list: &x.RemoveAddresses}) - if !f(fd_MsgRemoveMarketAuthorities_remove_addresses, value) { - return - } - } - if x.Admin != "" { - value := protoreflect.ValueOfString(x.Admin) - if !f(fd_MsgRemoveMarketAuthorities_admin, 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_MsgRemoveMarketAuthorities) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.remove_addresses": - return len(x.RemoveAddresses) != 0 - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.admin": - return x.Admin != "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthorities")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthorities 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_MsgRemoveMarketAuthorities) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.remove_addresses": - x.RemoveAddresses = nil - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.admin": - x.Admin = "" - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthorities")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthorities 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_MsgRemoveMarketAuthorities) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.remove_addresses": - if len(x.RemoveAddresses) == 0 { - return protoreflect.ValueOfList(&_MsgRemoveMarketAuthorities_1_list{}) - } - listValue := &_MsgRemoveMarketAuthorities_1_list{list: &x.RemoveAddresses} - return protoreflect.ValueOfList(listValue) - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.admin": - value := x.Admin - return protoreflect.ValueOfString(value) - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthorities")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthorities 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_MsgRemoveMarketAuthorities) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.remove_addresses": - lv := value.List() - clv := lv.(*_MsgRemoveMarketAuthorities_1_list) - x.RemoveAddresses = *clv.list - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.admin": - x.Admin = value.Interface().(string) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthorities")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthorities 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_MsgRemoveMarketAuthorities) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.remove_addresses": - if x.RemoveAddresses == nil { - x.RemoveAddresses = []string{} - } - value := &_MsgRemoveMarketAuthorities_1_list{list: &x.RemoveAddresses} - return protoreflect.ValueOfList(value) - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.admin": - panic(fmt.Errorf("field admin of message slinky.mm2.v1.MsgRemoveMarketAuthorities is not mutable")) - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthorities")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthorities 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_MsgRemoveMarketAuthorities) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.remove_addresses": - list := []string{} - return protoreflect.ValueOfList(&_MsgRemoveMarketAuthorities_1_list{list: &list}) - case "slinky.mm2.v1.MsgRemoveMarketAuthorities.admin": - return protoreflect.ValueOfString("") - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthorities")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthorities 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_MsgRemoveMarketAuthorities) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgRemoveMarketAuthorities", 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_MsgRemoveMarketAuthorities) 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_MsgRemoveMarketAuthorities) 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_MsgRemoveMarketAuthorities) 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_MsgRemoveMarketAuthorities) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgRemoveMarketAuthorities) - if x == nil { - return protoiface.SizeOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Size: 0, - } - } - options := runtime.SizeInputToOptions(input) - _ = options - var n int - var l int - _ = l - if len(x.RemoveAddresses) > 0 { - for _, s := range x.RemoveAddresses { - l = len(s) - n += 1 + l + runtime.Sov(uint64(l)) - } - } - l = len(x.Admin) - 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().(*MsgRemoveMarketAuthorities) - 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.Admin) > 0 { - i -= len(x.Admin) - copy(dAtA[i:], x.Admin) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Admin))) - i-- - dAtA[i] = 0x12 - } - if len(x.RemoveAddresses) > 0 { - for iNdEx := len(x.RemoveAddresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(x.RemoveAddresses[iNdEx]) - copy(dAtA[i:], x.RemoveAddresses[iNdEx]) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RemoveAddresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - if input.Buf != nil { - input.Buf = append(input.Buf, dAtA...) - } else { - input.Buf = dAtA - } - return protoiface.MarshalOutput{ - NoUnkeyedLiterals: input.NoUnkeyedLiterals, - Buf: input.Buf, - }, nil - } - unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*MsgRemoveMarketAuthorities) - 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: MsgRemoveMarketAuthorities: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketAuthorities: 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 RemoveAddresses", 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.RemoveAddresses = append(x.RemoveAddresses, 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 Admin", 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.Admin = 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_MsgRemoveMarketAuthoritiesResponse protoreflect.MessageDescriptor -) - -func init() { - file_slinky_mm2_v1_tx_proto_init() - md_MsgRemoveMarketAuthoritiesResponse = File_slinky_mm2_v1_tx_proto.Messages().ByName("MsgRemoveMarketAuthoritiesResponse") -} - -var _ protoreflect.Message = (*fastReflection_MsgRemoveMarketAuthoritiesResponse)(nil) - -type fastReflection_MsgRemoveMarketAuthoritiesResponse MsgRemoveMarketAuthoritiesResponse - -func (x *MsgRemoveMarketAuthoritiesResponse) ProtoReflect() protoreflect.Message { - return (*fastReflection_MsgRemoveMarketAuthoritiesResponse)(x) -} - -func (x *MsgRemoveMarketAuthoritiesResponse) slowProtoReflect() protoreflect.Message { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[7] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -var _fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType -var _ protoreflect.MessageType = fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType{} - -type fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType struct{} - -func (x fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType) Zero() protoreflect.Message { - return (*fastReflection_MsgRemoveMarketAuthoritiesResponse)(nil) -} -func (x fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType) New() protoreflect.Message { - return new(fastReflection_MsgRemoveMarketAuthoritiesResponse) -} -func (x fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveMarketAuthoritiesResponse -} - -// Descriptor returns message descriptor, which contains only the protobuf -// type information for the message. -func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Descriptor() protoreflect.MessageDescriptor { - return md_MsgRemoveMarketAuthoritiesResponse -} - -// 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_MsgRemoveMarketAuthoritiesResponse) Type() protoreflect.MessageType { - return _fastReflection_MsgRemoveMarketAuthoritiesResponse_messageType -} - -// New returns a newly allocated and mutable empty message. -func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) New() protoreflect.Message { - return new(fastReflection_MsgRemoveMarketAuthoritiesResponse) -} - -// Interface unwraps the message reflection interface and -// returns the underlying ProtoMessage interface. -func (x *fastReflection_MsgRemoveMarketAuthoritiesResponse) Interface() protoreflect.ProtoMessage { - return (*MsgRemoveMarketAuthoritiesResponse)(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_MsgRemoveMarketAuthoritiesResponse) 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_MsgRemoveMarketAuthoritiesResponse) Has(fd protoreflect.FieldDescriptor) bool { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgRemoveMarketAuthoritiesResponse) Clear(fd protoreflect.FieldDescriptor) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgRemoveMarketAuthoritiesResponse) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { - switch descriptor.FullName() { - default: - if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgRemoveMarketAuthoritiesResponse) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgRemoveMarketAuthoritiesResponse) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgRemoveMarketAuthoritiesResponse) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { - switch fd.FullName() { - default: - if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse")) - } - panic(fmt.Errorf("message slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse 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_MsgRemoveMarketAuthoritiesResponse) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { - switch d.FullName() { - default: - panic(fmt.Errorf("%s is not a oneof field in slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse", 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_MsgRemoveMarketAuthoritiesResponse) 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_MsgRemoveMarketAuthoritiesResponse) 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_MsgRemoveMarketAuthoritiesResponse) 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_MsgRemoveMarketAuthoritiesResponse) ProtoMethods() *protoiface.Methods { - size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*MsgRemoveMarketAuthoritiesResponse) - 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().(*MsgRemoveMarketAuthoritiesResponse) - 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().(*MsgRemoveMarketAuthoritiesResponse) - 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: MsgRemoveMarketAuthoritiesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: MsgRemoveMarketAuthoritiesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := runtime.Skip(dAtA[iNdEx:]) - if err != nil { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength - } - if (iNdEx + skippy) > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - if !options.DiscardUnknown { - x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) - } - iNdEx += skippy - } - } - - if iNdEx > l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil - } - return &protoiface.Methods{ - NoUnkeyedLiterals: struct{}{}, - Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, - Size: size, - Marshal: marshal, - Unmarshal: unmarshal, - Merge: nil, - CheckInitialized: nil, - } -} - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: slinky/mm2/v1/tx.proto - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -// MsgCreateMarkets defines a message carrying a payload for creating markets in -// the x/marketmap module. -type MsgCreateMarkets struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // CreateMarkets is the list of all markets to be created for the given - // transaction. - CreateMarkets []*Market `protobuf:"bytes,2,rep,name=create_markets,json=createMarkets,proto3" json:"create_markets,omitempty"` -} - -func (x *MsgCreateMarkets) Reset() { - *x = MsgCreateMarkets{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgCreateMarkets) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgCreateMarkets) ProtoMessage() {} - -// Deprecated: Use MsgCreateMarkets.ProtoReflect.Descriptor instead. -func (*MsgCreateMarkets) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{0} -} - -func (x *MsgCreateMarkets) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *MsgCreateMarkets) GetCreateMarkets() []*Market { - if x != nil { - return x.CreateMarkets - } - return nil -} - -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -type MsgCreateMarketsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgCreateMarketsResponse) Reset() { - *x = MsgCreateMarketsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgCreateMarketsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgCreateMarketsResponse) ProtoMessage() {} - -// Deprecated: Use MsgCreateMarketsResponse.ProtoReflect.Descriptor instead. -func (*MsgCreateMarketsResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{1} -} - -// MsgUpdateMarkets defines a message carrying a payload for updating the -// x/marketmap module. -type MsgUpdateMarkets struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // UpdateMarkets is the list of all markets to be updated for the given - // transaction. - UpdateMarkets []*Market `protobuf:"bytes,2,rep,name=update_markets,json=updateMarkets,proto3" json:"update_markets,omitempty"` -} - -func (x *MsgUpdateMarkets) Reset() { - *x = MsgUpdateMarkets{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUpdateMarkets) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateMarkets) ProtoMessage() {} - -// Deprecated: Use MsgUpdateMarkets.ProtoReflect.Descriptor instead. -func (*MsgUpdateMarkets) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{2} -} - -func (x *MsgUpdateMarkets) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -func (x *MsgUpdateMarkets) GetUpdateMarkets() []*Market { - if x != nil { - return x.UpdateMarkets - } - return nil -} - -// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. -type MsgUpdateMarketsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgUpdateMarketsResponse) Reset() { - *x = MsgUpdateMarketsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[3] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgUpdateMarketsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgUpdateMarketsResponse) ProtoMessage() {} - -// Deprecated: Use MsgUpdateMarketsResponse.ProtoReflect.Descriptor instead. -func (*MsgUpdateMarketsResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{3} -} - -// MsgParams defines the Msg/Params request type. It contains the -// new parameters for the x/marketmap module. -type MsgParams struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Params defines the new parameters for the x/marketmap module. - Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` - // Authority defines the authority that is updating the x/marketmap module - // parameters. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (x *MsgParams) Reset() { - *x = MsgParams{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[4] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgParams) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgParams) ProtoMessage() {} - -// Deprecated: Use MsgParams.ProtoReflect.Descriptor instead. -func (*MsgParams) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{4} -} - -func (x *MsgParams) GetParams() *Params { - if x != nil { - return x.Params - } - return nil -} - -func (x *MsgParams) GetAuthority() string { - if x != nil { - return x.Authority - } - return "" -} - -// MsgParamsResponse defines the Msg/Params response type. -type MsgParamsResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgParamsResponse) Reset() { - *x = MsgParamsResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[5] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgParamsResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgParamsResponse) ProtoMessage() {} - -// Deprecated: Use MsgParamsResponse.ProtoReflect.Descriptor instead. -func (*MsgParamsResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{5} -} - -// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse -// request type. It contains the new addresses to remove from the list of -// authorities -type MsgRemoveMarketAuthorities struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // RemoveAddresses is the list of addresses to remove. - RemoveAddresses []string `protobuf:"bytes,1,rep,name=remove_addresses,json=removeAddresses,proto3" json:"remove_addresses,omitempty"` - // Admin defines the authority that is the x/marketmap - // Admin account. This account is set in the module parameters. - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` -} - -func (x *MsgRemoveMarketAuthorities) Reset() { - *x = MsgRemoveMarketAuthorities{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[6] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgRemoveMarketAuthorities) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgRemoveMarketAuthorities) ProtoMessage() {} - -// Deprecated: Use MsgRemoveMarketAuthorities.ProtoReflect.Descriptor instead. -func (*MsgRemoveMarketAuthorities) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{6} -} - -func (x *MsgRemoveMarketAuthorities) GetRemoveAddresses() []string { - if x != nil { - return x.RemoveAddresses - } - return nil -} - -func (x *MsgRemoveMarketAuthorities) GetAdmin() string { - if x != nil { - return x.Admin - } - return "" -} - -// MsgRemoveMarketAuthoritiesResponse defines the -// Msg/RemoveMarketAuthoritiesResponse response type. -type MsgRemoveMarketAuthoritiesResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields -} - -func (x *MsgRemoveMarketAuthoritiesResponse) Reset() { - *x = MsgRemoveMarketAuthoritiesResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_slinky_mm2_v1_tx_proto_msgTypes[7] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MsgRemoveMarketAuthoritiesResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MsgRemoveMarketAuthoritiesResponse) ProtoMessage() {} - -// Deprecated: Use MsgRemoveMarketAuthoritiesResponse.ProtoReflect.Descriptor instead. -func (*MsgRemoveMarketAuthoritiesResponse) Descriptor() ([]byte, []int) { - return file_slinky_mm2_v1_tx_proto_rawDescGZIP(), []int{7} -} - -var File_slinky_mm2_v1_tx_proto protoreflect.FileDescriptor - -var file_slinky_mm2_v1_tx_proto_rawDesc = []byte{ - 0x0a, 0x16, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, - 0x74, 0x78, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0d, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x1a, 0x17, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, - 0x6d, 0x73, 0x67, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x73, 0x67, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, - 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 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, 0x1a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, - 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x1a, 0x1a, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x2f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xca, 0x01, 0x0a, - 0x10, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, - 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0e, 0x63, 0x72, 0x65, - 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, - 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, - 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, - 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x3a, 0xe8, - 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, - 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x6d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, - 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xca, 0x01, 0x0a, 0x10, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, - 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, - 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x79, 0x12, 0x42, 0x0a, 0x0e, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, 0x6c, 0x69, - 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x3a, 0x3a, 0xe8, 0xa0, 0x1f, 0x00, 0x82, 0xe7, 0xb0, 0x2a, - 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x23, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x78, 0x2f, 0x6d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x6d, 0x61, - 0x70, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, - 0x74, 0x73, 0x22, 0x1a, 0x0a, 0x18, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, - 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x88, - 0x01, 0x0a, 0x09, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x33, 0x0a, 0x06, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x12, 0x36, 0x0a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x3a, 0x0e, 0x82, 0xe7, 0xb0, 0x2a, 0x09, - 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x13, 0x0a, 0x11, 0x4d, 0x73, 0x67, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x83, - 0x01, 0x0a, 0x1a, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x29, 0x0a, - 0x10, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x5f, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, - 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x41, - 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x65, 0x73, 0x12, 0x2e, 0x0a, 0x05, 0x61, 0x64, 0x6d, 0x69, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x18, 0xd2, 0xb4, 0x2d, 0x14, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, - 0x67, 0x52, 0x05, 0x61, 0x64, 0x6d, 0x69, 0x6e, 0x3a, 0x0a, 0x82, 0xe7, 0xb0, 0x2a, 0x05, 0x61, - 0x64, 0x6d, 0x69, 0x6e, 0x22, 0x24, 0x0a, 0x22, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, - 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, - 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x81, 0x03, 0x0a, 0x03, 0x4d, - 0x73, 0x67, 0x12, 0x59, 0x0a, 0x0d, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, - 0x65, 0x74, 0x73, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, - 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, - 0x6b, 0x65, 0x74, 0x73, 0x1a, 0x27, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, - 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x59, 0x0a, - 0x0d, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x12, 0x1f, - 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, 0x1a, - 0x27, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x73, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x44, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x12, 0x18, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, - 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x20, 0x2e, 0x73, - 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, - 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x77, - 0x0a, 0x17, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, - 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x12, 0x29, 0x2e, 0x73, 0x6c, 0x69, 0x6e, - 0x6b, 0x79, 0x2e, 0x6d, 0x6d, 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, - 0x6f, 0x76, 0x65, 0x4d, 0x61, 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, - 0x74, 0x69, 0x65, 0x73, 0x1a, 0x31, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, - 0x32, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x73, 0x67, 0x52, 0x65, 0x6d, 0x6f, 0x76, 0x65, 0x4d, 0x61, - 0x72, 0x6b, 0x65, 0x74, 0x41, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x69, 0x65, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x98, - 0x01, 0x0a, 0x11, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x6d, 0x6d, - 0x32, 0x2e, 0x76, 0x31, 0x42, 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x24, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x73, 0x6c, 0x69, 0x6e, 0x6b, 0x79, 0x2f, 0x6d, 0x6d, 0x32, 0x2f, 0x76, 0x31, 0x3b, - 0x6d, 0x6d, 0x32, 0x76, 0x31, 0xa2, 0x02, 0x03, 0x53, 0x4d, 0x58, 0xaa, 0x02, 0x0d, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x2e, 0x4d, 0x6d, 0x32, 0x2e, 0x56, 0x31, 0xca, 0x02, 0x0d, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x56, 0x31, 0xe2, 0x02, 0x19, 0x53, 0x6c, - 0x69, 0x6e, 0x6b, 0x79, 0x5c, 0x4d, 0x6d, 0x32, 0x5c, 0x56, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, - 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0f, 0x53, 0x6c, 0x69, 0x6e, 0x6b, 0x79, - 0x3a, 0x3a, 0x4d, 0x6d, 0x32, 0x3a, 0x3a, 0x56, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, -} - -var ( - file_slinky_mm2_v1_tx_proto_rawDescOnce sync.Once - file_slinky_mm2_v1_tx_proto_rawDescData = file_slinky_mm2_v1_tx_proto_rawDesc -) - -func file_slinky_mm2_v1_tx_proto_rawDescGZIP() []byte { - file_slinky_mm2_v1_tx_proto_rawDescOnce.Do(func() { - file_slinky_mm2_v1_tx_proto_rawDescData = protoimpl.X.CompressGZIP(file_slinky_mm2_v1_tx_proto_rawDescData) - }) - return file_slinky_mm2_v1_tx_proto_rawDescData -} - -var file_slinky_mm2_v1_tx_proto_msgTypes = make([]protoimpl.MessageInfo, 8) -var file_slinky_mm2_v1_tx_proto_goTypes = []interface{}{ - (*MsgCreateMarkets)(nil), // 0: slinky.mm2.v1.MsgCreateMarkets - (*MsgCreateMarketsResponse)(nil), // 1: slinky.mm2.v1.MsgCreateMarketsResponse - (*MsgUpdateMarkets)(nil), // 2: slinky.mm2.v1.MsgUpdateMarkets - (*MsgUpdateMarketsResponse)(nil), // 3: slinky.mm2.v1.MsgUpdateMarketsResponse - (*MsgParams)(nil), // 4: slinky.mm2.v1.MsgParams - (*MsgParamsResponse)(nil), // 5: slinky.mm2.v1.MsgParamsResponse - (*MsgRemoveMarketAuthorities)(nil), // 6: slinky.mm2.v1.MsgRemoveMarketAuthorities - (*MsgRemoveMarketAuthoritiesResponse)(nil), // 7: slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse - (*Market)(nil), // 8: slinky.mm2.v1.Market - (*Params)(nil), // 9: slinky.mm2.v1.Params -} -var file_slinky_mm2_v1_tx_proto_depIdxs = []int32{ - 8, // 0: slinky.mm2.v1.MsgCreateMarkets.create_markets:type_name -> slinky.mm2.v1.Market - 8, // 1: slinky.mm2.v1.MsgUpdateMarkets.update_markets:type_name -> slinky.mm2.v1.Market - 9, // 2: slinky.mm2.v1.MsgParams.params:type_name -> slinky.mm2.v1.Params - 0, // 3: slinky.mm2.v1.Msg.CreateMarkets:input_type -> slinky.mm2.v1.MsgCreateMarkets - 2, // 4: slinky.mm2.v1.Msg.UpdateMarkets:input_type -> slinky.mm2.v1.MsgUpdateMarkets - 4, // 5: slinky.mm2.v1.Msg.Params:input_type -> slinky.mm2.v1.MsgParams - 6, // 6: slinky.mm2.v1.Msg.RemoveMarketAuthorities:input_type -> slinky.mm2.v1.MsgRemoveMarketAuthorities - 1, // 7: slinky.mm2.v1.Msg.CreateMarkets:output_type -> slinky.mm2.v1.MsgCreateMarketsResponse - 3, // 8: slinky.mm2.v1.Msg.UpdateMarkets:output_type -> slinky.mm2.v1.MsgUpdateMarketsResponse - 5, // 9: slinky.mm2.v1.Msg.Params:output_type -> slinky.mm2.v1.MsgParamsResponse - 7, // 10: slinky.mm2.v1.Msg.RemoveMarketAuthorities:output_type -> slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse - 7, // [7:11] is the sub-list for method output_type - 3, // [3:7] 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_slinky_mm2_v1_tx_proto_init() } -func file_slinky_mm2_v1_tx_proto_init() { - if File_slinky_mm2_v1_tx_proto != nil { - return - } - file_slinky_mm2_v1_market_proto_init() - file_slinky_mm2_v1_params_proto_init() - if !protoimpl.UnsafeEnabled { - file_slinky_mm2_v1_tx_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgCreateMarkets); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgCreateMarketsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateMarkets); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgUpdateMarketsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgParams); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgParamsResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgRemoveMarketAuthorities); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_slinky_mm2_v1_tx_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MsgRemoveMarketAuthoritiesResponse); 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_slinky_mm2_v1_tx_proto_rawDesc, - NumEnums: 0, - NumMessages: 8, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_slinky_mm2_v1_tx_proto_goTypes, - DependencyIndexes: file_slinky_mm2_v1_tx_proto_depIdxs, - MessageInfos: file_slinky_mm2_v1_tx_proto_msgTypes, - }.Build() - File_slinky_mm2_v1_tx_proto = out.File - file_slinky_mm2_v1_tx_proto_rawDesc = nil - file_slinky_mm2_v1_tx_proto_goTypes = nil - file_slinky_mm2_v1_tx_proto_depIdxs = nil -} diff --git a/api/slinky/mm2/v1/tx_grpc.pb.go b/api/slinky/mm2/v1/tx_grpc.pb.go deleted file mode 100644 index b272f7be8..000000000 --- a/api/slinky/mm2/v1/tx_grpc.pb.go +++ /dev/null @@ -1,230 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.3.0 -// - protoc (unknown) -// source: slinky/mm2/v1/tx.proto - -package mm2v1 - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -const ( - Msg_CreateMarkets_FullMethodName = "/slinky.mm2.v1.Msg/CreateMarkets" - Msg_UpdateMarkets_FullMethodName = "/slinky.mm2.v1.Msg/UpdateMarkets" - Msg_Params_FullMethodName = "/slinky.mm2.v1.Msg/Params" - Msg_RemoveMarketAuthorities_FullMethodName = "/slinky.mm2.v1.Msg/RemoveMarketAuthorities" -) - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -type MsgClient interface { - // CreateMarkets creates markets from the given message. - CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) - // UpdateMarkets updates markets from the given message. - UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) - // Params defines a method for updating the x/marketmap module parameters. - Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) - // RemoveMarketAuthorities defines a method for removing market authorities - // from the x/marketmap module. the signer must be the admin. - RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) -} - -type msgClient struct { - cc grpc.ClientConnInterface -} - -func NewMsgClient(cc grpc.ClientConnInterface) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) { - out := new(MsgCreateMarketsResponse) - err := c.cc.Invoke(ctx, Msg_CreateMarkets_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) { - out := new(MsgUpdateMarketsResponse) - err := c.cc.Invoke(ctx, Msg_UpdateMarkets_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) { - out := new(MsgParamsResponse) - err := c.cc.Invoke(ctx, Msg_Params_FullMethodName, in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) { - out := new(MsgRemoveMarketAuthoritiesResponse) - err := c.cc.Invoke(ctx, Msg_RemoveMarketAuthorities_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 -type MsgServer interface { - // CreateMarkets creates markets from the given message. - CreateMarkets(context.Context, *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) - // UpdateMarkets updates markets from the given message. - UpdateMarkets(context.Context, *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) - // Params defines a method for updating the x/marketmap module parameters. - Params(context.Context, *MsgParams) (*MsgParamsResponse, error) - // RemoveMarketAuthorities defines a method for removing market authorities - // from the x/marketmap module. the signer must be the admin. - RemoveMarketAuthorities(context.Context, *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) - mustEmbedUnimplementedMsgServer() -} - -// UnimplementedMsgServer must be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (UnimplementedMsgServer) CreateMarkets(context.Context, *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateMarkets not implemented") -} -func (UnimplementedMsgServer) UpdateMarkets(context.Context, *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateMarkets not implemented") -} -func (UnimplementedMsgServer) Params(context.Context, *MsgParams) (*MsgParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (UnimplementedMsgServer) RemoveMarketAuthorities(context.Context, *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveMarketAuthorities not implemented") -} -func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {} - -// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MsgServer will -// result in compilation errors. -type UnsafeMsgServer interface { - mustEmbedUnimplementedMsgServer() -} - -func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) { - s.RegisterService(&Msg_ServiceDesc, srv) -} - -func _Msg_CreateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateMarkets) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateMarkets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_CreateMarkets_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateMarkets(ctx, req.(*MsgCreateMarkets)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateMarkets) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateMarkets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_UpdateMarkets_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateMarkets(ctx, req.(*MsgUpdateMarkets)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_Params_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Params(ctx, req.(*MsgParams)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RemoveMarketAuthorities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveMarketAuthorities) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RemoveMarketAuthorities(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: Msg_RemoveMarketAuthorities_FullMethodName, - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveMarketAuthorities(ctx, req.(*MsgRemoveMarketAuthorities)) - } - 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) -var Msg_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.mm2.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateMarkets", - Handler: _Msg_CreateMarkets_Handler, - }, - { - MethodName: "UpdateMarkets", - Handler: _Msg_UpdateMarkets_Handler, - }, - { - MethodName: "Params", - Handler: _Msg_Params_Handler, - }, - { - MethodName: "RemoveMarketAuthorities", - Handler: _Msg_RemoveMarketAuthorities_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/mm2/v1/tx.proto", -} diff --git a/cmd/slinky-config/main.go b/cmd/slinky-config/main.go index 81e27e3a5..58e106cdc 100644 --- a/cmd/slinky-config/main.go +++ b/cmd/slinky-config/main.go @@ -86,16 +86,13 @@ var ( updateInterval time.Duration // maxPriceAge is the maximum age of a price that the oracle will accept. maxPriceAge time.Duration - // raydium-enabled determine whether or not the raydium defi provider will be configured. raydiumEnabled bool - // solana node url is the solana node that the raydium provider will connect to. solanaNodeURLs []string - // ProviderToMarkets defines a map of provider names to their respective market // configurations. This is used to generate the local market config file. - ProviderToMarkets = map[string]types.TickerToProviderConfig{ + ProviderToMarkets = map[string]types.CurrencyPairsToProviderTickers{ // ----------------------------------------------------------- // // ---------------------Start API Providers-------------------- // // ----------------------------------------------------------- // @@ -130,7 +127,7 @@ var ( // ----------------------Metrics Config----------------------- // // ----------------------------------------------------------- // Metrics: config.MetricsConfig{}, - UpdateInterval: 500 * time.Millisecond, + UpdateInterval: 250 * time.Millisecond, MaxPriceAge: 2 * time.Minute, Providers: []config.ProviderConfig{ // ----------------------------------------------------------- // @@ -344,10 +341,8 @@ func createOracleConfig() error { if strings.ToLower(chain) == constants.DYDX { // Filter out the providers that are not supported by the dYdX chain. validProviders := make(map[string]struct{}) - for _, providers := range dydx.ProviderMapping { - for _, provider := range providers { - validProviders[provider] = struct{}{} - } + for _, slinkyProvider := range dydx.ProviderMapping { + validProviders[slinkyProvider] = struct{}{} } ps := make([]config.ProviderConfig, 0) @@ -441,15 +436,11 @@ func createMarketMap() error { return nil } - var ( - // Tickers defines a map of tickers to their respective ticker configurations. This - // contains all of the tickers that are supported by the oracle. - tickers = make(map[string]mmtypes.Ticker) - // TickersToProviders defines a map of tickers to their respective providers. This - // contains all of the providers that are supported per ticker. - tickersToProviders = make(map[string]mmtypes.Providers) - tickersToPaths = make(map[string]mmtypes.Paths) - ) + // Tickers defines a map of tickers to their respective ticker configurations. This + // contains all of the tickers that are supported by the oracle. + marketMap := mmtypes.MarketMap{ + Markets: make(map[string]mmtypes.Market), + } // if raydium is enabled, configure the raydium markets based on the local raydium_pairs fixture if raydiumEnabled { @@ -458,50 +449,32 @@ func createMarketMap() error { // Iterate through all of the provider ticker configurations and update the // tickers and tickers to providers maps. - for name, providerConfig := range ProviderToMarkets { - for ticker, config := range providerConfig { - tickerStr := ticker.String() - - // Add the ticker to the tickers map iff the ticker does not already exist. If the - // ticker already exists, ensure that the ticker configuration is the same. - if t, ok := tickers[tickerStr]; !ok { - tickers[tickerStr] = ticker - } else if t != ticker { - return fmt.Errorf("ticker %s already exists with different configuration for provider %s", tickerStr, name) + for provider, providerConfig := range ProviderToMarkets { + for cp, config := range providerConfig { + ticker := mmtypes.Ticker{ + CurrencyPair: cp, + Decimals: 18, + MinProviderCount: 1, } - // Instantiate the providers for a given ticker. - if _, ok := tickersToProviders[tickerStr]; !ok { - tickersToProviders[tickerStr] = mmtypes.Providers{} + // Add the ticker to the tickers map iff the ticker does not already exist. + if _, ok := marketMap.Markets[ticker.String()]; !ok { + marketMap.Markets[ticker.String()] = mmtypes.Market{ + Ticker: ticker, + ProviderConfigs: make([]mmtypes.ProviderConfig, 0), + } } - // Add the provider to the tickers to providers map. - providers := tickersToProviders[tickerStr].Providers - providers = append(providers, config) - tickersToProviders[tickerStr] = mmtypes.Providers{Providers: providers} - - if _, ok := tickersToPaths[tickerStr]; !ok { - tickersToPaths[tickerStr] = mmtypes.Paths{} - } - paths := tickersToPaths[tickerStr].Paths - paths = append(paths, mmtypes.Path{Operations: []mmtypes.Operation{ - { - CurrencyPair: ticker.CurrencyPair, - Invert: false, - Provider: config.Name, - }, - }}) - tickersToPaths[tickerStr] = mmtypes.Paths{Paths: paths} + market := marketMap.Markets[ticker.String()] + market.ProviderConfigs = append(market.ProviderConfigs, mmtypes.ProviderConfig{ + Name: provider, + OffChainTicker: config.OffChainTicker, + Metadata_JSON: config.JSON, + }) + marketMap.Markets[ticker.String()] = market } } - // Create a new market map from the provider to market map. - marketMap := mmtypes.MarketMap{ - Tickers: tickers, - Providers: tickersToProviders, - Paths: tickersToPaths, - } - // Validate the market map. if err := marketMap.ValidateBasic(); err != nil { return fmt.Errorf("error validating the market map: %w", err) @@ -538,7 +511,7 @@ type TickerMetaData struct { TickerMetaData raydium.TickerMetadata `json:"ticker_metadata"` } -func addRaydiumMarkets(providerToMarkets map[string]map[mmtypes.Ticker]mmtypes.ProviderConfig) map[string]map[mmtypes.Ticker]mmtypes.ProviderConfig { +func addRaydiumMarkets(providerToMarkets map[string]types.CurrencyPairsToProviderTickers) map[string]types.CurrencyPairsToProviderTickers { // read the raydium_pairs fixture if !raydiumEnabled { return providerToMarkets @@ -565,17 +538,11 @@ func addRaydiumMarkets(providerToMarkets map[string]map[mmtypes.Ticker]mmtypes.P } // add the raydium markets to the provider to markets map - providerToMarkets[raydium.Name] = make(map[mmtypes.Ticker]mmtypes.ProviderConfig) + providerToMarkets[raydium.Name] = make(types.CurrencyPairsToProviderTickers) for _, pair := range raydiumPairs { - providerToMarkets[raydium.Name][mmtypes.Ticker{ - CurrencyPair: pair.Cp, - Decimals: 18, - MinProviderCount: 1, - Enabled: true, - Metadata_JSON: marshalToJSONString(pair.TickerMetaData), - }] = mmtypes.ProviderConfig{ - Name: raydium.Name, + providerToMarkets[raydium.Name][pair.Cp] = types.DefaultProviderTicker{ OffChainTicker: pair.Cp.String(), + JSON: marshalToJSONString(pair.TickerMetaData), } } diff --git a/cmd/slinky/main.go b/cmd/slinky/main.go index 37344b525..848cb6944 100644 --- a/cmd/slinky/main.go +++ b/cmd/slinky/main.go @@ -17,7 +17,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" oraclemetrics "github.com/skip-mev/slinky/oracle/metrics" "github.com/skip-mev/slinky/oracle/orchestrator" - "github.com/skip-mev/slinky/oracle/types" oraclemath "github.com/skip-mev/slinky/pkg/math/oracle" oraclefactory "github.com/skip-mev/slinky/providers/factories/oracle" oracleserver "github.com/skip-mev/slinky/service/servers/oracle" @@ -104,7 +103,7 @@ func runOracle() error { var marketCfg mmtypes.MarketMap if marketCfgPath != "" { - marketCfg, err = types.ReadMarketConfigFromFile(marketCfgPath) + marketCfg, err = mmtypes.ReadMarketMapFromFile(marketCfgPath) if err != nil { return fmt.Errorf("failed to read market config file: %s", err.Error()) } diff --git a/config/dydx/market.json b/config/dydx/market.json index 65b0daf86..ec3a80d2f 100644 --- a/config/dydx/market.json +++ b/config/dydx/market.json @@ -1,8646 +1,30 @@ { - "tickers": { + "markets": { "AAVE/USD": { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "ADA/USD": { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "AEVO/USD": { - "currency_pair": { - "Base": "AEVO", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "AGIX/USD": { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "ALGO/USD": { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "APE/USD": { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "APT/USD": { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "ARB/USD": { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "ARKM/USD": { - "currency_pair": { - "Base": "ARKM", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "ASTR/USD": { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "ATOM/USD": { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "AVAX/USD": { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "AXL/USD": { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "BCH/USD": { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "decimals": 7, - "min_provider_count": 3 - }, - "BLUR/USD": { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "BNB/USD": { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "decimals": 7, - "min_provider_count": 3 - }, - "BONK/USD": { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "decimals": 14, - "min_provider_count": 3 - }, - "BTC/USD": { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "decimals": 5, - "min_provider_count": 3 - }, - "COMP/USD": { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "CRV/USD": { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "DOGE/USD": { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "decimals": 11, - "min_provider_count": 3 - }, - "DOT/USD": { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "DYDX/USD": { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "DYM/USD": { - "currency_pair": { - "Base": "DYM", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "EOS/USD": { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "ETC/USD": { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "ETH/USD": { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "decimals": 6, - "min_provider_count": 3 - }, - "FET/USD": { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "FIL/USD": { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "GRT/USD": { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "HBAR/USD": { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "ICP/USD": { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "IMX/USD": { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "INJ/USD": { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "JTO/USD": { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "JUP/USD": { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "LDO/USD": { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "LINK/USD": { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "LTC/USD": { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "MANA/USD": { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "MATIC/USD": { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "MKR/USD": { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "decimals": 6, - "min_provider_count": 3 - }, - "NEAR/USD": { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "OP/USD": { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "ORDI/USD": { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "PEPE/USD": { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "decimals": 16, - "min_provider_count": 3 - }, - "PYTH/USD": { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "RNDR/USD": { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "RUNE/USD": { - "currency_pair": { - "Base": "RUNE", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "SEI/USD": { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "SHIB/USD": { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "decimals": 15, - "min_provider_count": 3 - }, - "SNX/USD": { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "SOL/USD": { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "STRK/USD": { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "STX/USD": { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "SUI/USD": { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "TIA/USD": { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 3 - }, - "TRX/USD": { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "decimals": 11, - "min_provider_count": 3 - }, - "UNI/USD": { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "USDT/USD": { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "WLD/USD": { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - }, - "WOO/USD": { - "currency_pair": { - "Base": "WOO", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "XLM/USD": { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "decimals": 10, - "min_provider_count": 3 - }, - "XRP/USD": { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" + "ticker": { + "currency_pair": { + "Base": "AAVE", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 }, - "decimals": 10, - "min_provider_count": 3 - } - }, - "paths": { - "AAVE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AAVE", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "ADA/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "AEVO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AEVO", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AEVO", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AEVO", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AEVO", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AEVO", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "AGIX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AGIX", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ALGO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ALGO", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "APE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "APT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ARB/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ARKM/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ARKM", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARKM", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARKM", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARKM", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARKM", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ASTR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ASTR", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ATOM/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "AVAX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "AXL/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AXL", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - } - ] - }, - "BCH/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "BLUR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "BNB/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BNB", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "BONK/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BONK", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "BTC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "COMP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "CRV/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "DOGE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "DOT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "DYDX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "DYM/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DYM", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYM", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYM", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYM", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYM", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "EOS/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "EOS", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ETC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ETH/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "FET/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FET", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "FIL/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "GRT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "GRT", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "HBAR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "HBAR", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ICP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ICP", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "IMX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "IMX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "INJ/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "INJ", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "JTO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JTO", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "JUP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "JUP", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "LDO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "LINK/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "LTC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "MANA/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MANA", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "MATIC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "MKR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "NEAR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "OP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "ORDI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ORDI", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "PEPE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "PYTH/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PYTH", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "RNDR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RNDR", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "RUNE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "RUNE", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RUNE", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RUNE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RUNE", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "RUNE", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "SEI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "SHIB/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "SNX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SNX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "SOL/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "STRK/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STRK", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "STX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "STX", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "SUI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "TIA/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "TRX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "UNI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "USDT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "invert": true, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "invert": true, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "invert": true, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "invert": true, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "invert": true, - "provider": "okx_ws" - } - ] - } - ] - }, - "WLD/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "WOO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "WOO", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WOO", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WOO", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WOO", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WOO", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "XLM/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - }, - "XRP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "binance_api" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "bybit_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "gate_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "huobi_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "kucoin_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "mexc_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "okx_ws" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "index_price" - } - ] - } - ] - } - }, - "providers": { - "AAVE/USD": { - "providers": [ + "provider_configs": [ { "name": "mexc_ws", - "off_chain_ticker": "AAVEUSDT" + "off_chain_ticker": "AAVEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "aaveusdt" + "off_chain_ticker": "aaveusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -8648,51 +32,79 @@ }, { "name": "okx_ws", - "off_chain_ticker": "AAVE-USDT" + "off_chain_ticker": "AAVE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "AAVE-USDT" + "off_chain_ticker": "AAVE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "binance_api", - "off_chain_ticker": "AAVEUSDT" + "off_chain_ticker": "AAVEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "AAVE-USD" - }, - { - "name": "coinbase_ws", - "off_chain_ticker": "AAVE-USD" } ] }, "ADA/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ADA", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ADAUSDT" + "off_chain_ticker": "ADAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ADAUSDT" + "off_chain_ticker": "ADAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "ADA-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "ADA-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "ADA_USDT" + "off_chain_ticker": "ADA_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "adausdt" + "off_chain_ticker": "adausdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -8700,86 +112,170 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "ADA-USDT" + "off_chain_ticker": "ADA-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ADAUSDT" + "off_chain_ticker": "ADAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ADA-USDT" + "off_chain_ticker": "ADA-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "AEVO/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AEVO", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "AEVOUSDT" + "off_chain_ticker": "AEVOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "AEVOUSDT" + "off_chain_ticker": "AEVOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "AEVO_USDT" + "off_chain_ticker": "AEVO_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "AEVOUSDT" + "off_chain_ticker": "AEVOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "AEVO-USDT" + "off_chain_ticker": "AEVO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "AGIX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AGIX", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "AGIXUSDT" + "off_chain_ticker": "AGIXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "AGIXUSDT" + "off_chain_ticker": "AGIXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "AGIX_USDT" + "off_chain_ticker": "AGIX_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "AGIX-USDT" + "off_chain_ticker": "AGIX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "AGIX-USDT" + "off_chain_ticker": "AGIX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "AGIXUSDT" + "off_chain_ticker": "AGIXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ALGO/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ALGO", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ALGOUSDT" + "off_chain_ticker": "ALGOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ALGOUSDT" - }, - { - "name": "coinbase_api", - "off_chain_ticker": "ALGO-USD" + "off_chain_ticker": "ALGOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { - "name": "coinbase_ws", + "name": "coinbase_api", "off_chain_ticker": "ALGO-USD" }, { @@ -8788,35 +284,59 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "ALGO-USDT" + "off_chain_ticker": "ALGO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ALGOUSDT" + "off_chain_ticker": "ALGOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ALGO-USDT" + "off_chain_ticker": "ALGO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "APE/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APE", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "APEUSDT" + "off_chain_ticker": "APEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "APE-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "APE-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "APE_USDT" + "off_chain_ticker": "APE_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -8824,131 +344,251 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "APE-USDT" + "off_chain_ticker": "APE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "APEUSDT" + "off_chain_ticker": "APEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "APE-USDT" + "off_chain_ticker": "APE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "APT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APT", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "APTUSDT" + "off_chain_ticker": "APTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "APTUSDT" + "off_chain_ticker": "APTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "APT-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "APT-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "APT_USDT" + "off_chain_ticker": "APT_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "aptusdt" + "off_chain_ticker": "aptusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "APT-USDT" + "off_chain_ticker": "APT-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "APTUSDT" + "off_chain_ticker": "APTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "APT-USDT" + "off_chain_ticker": "APT-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ARB/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ARB", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ARBUSDT" + "off_chain_ticker": "ARBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ARBUSDT" + "off_chain_ticker": "ARBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "ARB-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "ARB-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "ARB_USDT" + "off_chain_ticker": "ARB_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "arbusdt" + "off_chain_ticker": "arbusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "ARB-USDT" + "off_chain_ticker": "ARB-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ARBUSDT" + "off_chain_ticker": "ARBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ARB-USDT" + "off_chain_ticker": "ARB-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ARKM/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ARKM", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ARKMUSDT" + "off_chain_ticker": "ARKMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ARKMUSDT" + "off_chain_ticker": "ARKMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "ARKM_USDT" + "off_chain_ticker": "ARKM_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "ARKM-USDT" + "off_chain_ticker": "ARKM-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ARKMUSDT" + "off_chain_ticker": "ARKMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ASTR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ASTR", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ASTRUSDT" + "off_chain_ticker": "ASTRUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "ASTR_USDT" + "off_chain_ticker": "ASTR_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -8956,39 +596,67 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "ASTR-USDT" + "off_chain_ticker": "ASTR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ASTRUSDT" + "off_chain_ticker": "ASTRUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ASTR-USDT" + "off_chain_ticker": "ASTR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ATOM/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ATOM", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ATOMUSDT" + "off_chain_ticker": "ATOMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ATOMUSDT" + "off_chain_ticker": "ATOMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "ATOM-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "ATOM-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "ATOM_USDT" + "off_chain_ticker": "ATOM_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -8996,43 +664,75 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "ATOM-USDT" + "off_chain_ticker": "ATOM-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ATOMUSDT" + "off_chain_ticker": "ATOMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ATOM-USDT" + "off_chain_ticker": "ATOM-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "AVAX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AVAX", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "AVAXUSDT" + "off_chain_ticker": "AVAXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "AVAXUSDT" + "off_chain_ticker": "AVAXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "AVAX-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "AVAX-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "AVAX_USDT" + "off_chain_ticker": "AVAX_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "avaxusdt" + "off_chain_ticker": "avaxusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9040,35 +740,59 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "AVAX-USDT" + "off_chain_ticker": "AVAX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "AVAX-USDT" + "off_chain_ticker": "AVAX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "AXL/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AXL", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "AXLUSDT" + "off_chain_ticker": "AXLUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "AXLUSDT" + "off_chain_ticker": "AXLUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "AXL-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "AXL-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "WAXL_USDT" + "off_chain_ticker": "WAXL_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9077,30 +801,50 @@ ] }, "BCH/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BCH", + "Quote": "USD" + }, + "decimals": 7, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "BCHUSDT" + "off_chain_ticker": "BCHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "BCHUSDT" + "off_chain_ticker": "BCHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "BCH-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "BCH-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "BCH_USDT" + "off_chain_ticker": "BCH_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "bchusdt" + "off_chain_ticker": "bchusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9108,31 +852,51 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "BCH-USDT" + "off_chain_ticker": "BCH-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "BCHUSDT" + "off_chain_ticker": "BCHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "BCH-USDT" + "off_chain_ticker": "BCH-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "BLUR/USD": { - "providers": [ - { - "name": "coinbase_api", - "off_chain_ticker": "BLUR-USD" + "ticker": { + "currency_pair": { + "Base": "BLUR", + "Quote": "USD" }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { - "name": "coinbase_ws", + "name": "coinbase_api", "off_chain_ticker": "BLUR-USD" }, { "name": "gate_ws", - "off_chain_ticker": "BLUR_USDT" + "off_chain_ticker": "BLUR_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9140,99 +904,183 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "BLUR-USDT" + "off_chain_ticker": "BLUR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "BLURUSDT" + "off_chain_ticker": "BLURUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "BLUR-USDT" + "off_chain_ticker": "BLUR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "BNB/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BNB", + "Quote": "USD" + }, + "decimals": 7, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "okx_ws", - "off_chain_ticker": "BNB-USDT" + "off_chain_ticker": "BNB-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "BNB-USDT" + "off_chain_ticker": "BNB-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "BNBUSDT" + "off_chain_ticker": "BNBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "binance_api", - "off_chain_ticker": "BNBUSDT" + "off_chain_ticker": "BNBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "BNBUSDT" + "off_chain_ticker": "BNBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "BNB_USDT" + "off_chain_ticker": "BNB_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "BONK/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BONK", + "Quote": "USD" + }, + "decimals": 14, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "BONKUSDT" + "off_chain_ticker": "BONKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "BONKUSDT" + "off_chain_ticker": "BONKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "BONK-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "BONK-USD" - }, { "name": "kucoin_ws", - "off_chain_ticker": "BONK-USDT" + "off_chain_ticker": "BONK-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "BONK-USDT" + "off_chain_ticker": "BONK-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "BONKUSDT" + "off_chain_ticker": "BONKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "BTC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BTC", + "Quote": "USD" + }, + "decimals": 5, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "BTCUSDT" + "off_chain_ticker": "BTCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "BTCUSDT" + "off_chain_ticker": "BTCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "BTC-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "BTC-USD" - }, { "name": "huobi_ws", - "off_chain_ticker": "btcusdt" + "off_chain_ticker": "btcusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9240,35 +1088,59 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "BTC-USDT" + "off_chain_ticker": "BTC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "BTCUSDT" + "off_chain_ticker": "BTCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "BTC-USDT" + "off_chain_ticker": "BTC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "COMP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "COMP", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "COMPUSDT" + "off_chain_ticker": "COMPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "COMP-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "COMP-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "COMP_USDT" + "off_chain_ticker": "COMP_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9276,31 +1148,51 @@ }, { "name": "mexc_ws", - "off_chain_ticker": "COMPUSDT" + "off_chain_ticker": "COMPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "COMP-USDT" + "off_chain_ticker": "COMP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "CRV/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "CRV", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "CRVUSDT" + "off_chain_ticker": "CRVUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "CRV-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "CRV-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "CRV_USDT" + "off_chain_ticker": "CRV_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9308,43 +1200,75 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "CRV-USDT" + "off_chain_ticker": "CRV-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "CRVUSDT" + "off_chain_ticker": "CRVUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "CRV-USDT" + "off_chain_ticker": "CRV-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "DOGE/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DOGE", + "Quote": "USD" + }, + "decimals": 11, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "DOGEUSDT" + "off_chain_ticker": "DOGEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "DOGEUSDT" + "off_chain_ticker": "DOGEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "DOGE-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "DOGE-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "DOGE_USDT" + "off_chain_ticker": "DOGE_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "dogeusdt" + "off_chain_ticker": "dogeusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9352,39 +1276,67 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "DOGE-USDT" + "off_chain_ticker": "DOGE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "DOGEUSDT" + "off_chain_ticker": "DOGEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "DOGE-USDT" + "off_chain_ticker": "DOGE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "DOT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DOT", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "DOTUSDT" + "off_chain_ticker": "DOTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "DOTUSDT" + "off_chain_ticker": "DOTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "DOT-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "DOT-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "DOT_USDT" + "off_chain_ticker": "DOT_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9392,91 +1344,179 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "DOT-USDT" + "off_chain_ticker": "DOT-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "DOTUSDT" + "off_chain_ticker": "DOTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "DOT-USDT" + "off_chain_ticker": "DOT-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "DYDX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DYDX", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "DYDXUSDT" + "off_chain_ticker": "DYDXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "DYDXUSDT" + "off_chain_ticker": "DYDXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "DYDX_USDT" + "off_chain_ticker": "DYDX_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "DYDX-USDT" + "off_chain_ticker": "DYDX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "DYDXUSDT" + "off_chain_ticker": "DYDXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "DYDX-USDT" + "off_chain_ticker": "DYDX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "DYM/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DYM", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "DYMUSDT" + "off_chain_ticker": "DYMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "DYMUSDT" + "off_chain_ticker": "DYMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "DYM_USDT" + "off_chain_ticker": "DYM_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "DYM-USDT" + "off_chain_ticker": "DYM-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "DYMUSDT" + "off_chain_ticker": "DYMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "EOS/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "EOS", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "EOSUSDT" + "off_chain_ticker": "EOSUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "EOSUSDT" + "off_chain_ticker": "EOSUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "EOS-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "EOS-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "EOS_USDT" + "off_chain_ticker": "EOS_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9484,75 +1524,131 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "EOS-USDT" + "off_chain_ticker": "EOS-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "EOS-USDT" + "off_chain_ticker": "EOS-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "EOSUSDT" + "off_chain_ticker": "EOSUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ETC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETC", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ETCUSDT" + "off_chain_ticker": "ETCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "ETC-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "ETC-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "ETC_USDT" + "off_chain_ticker": "ETC_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "etcusdt" + "off_chain_ticker": "etcusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "ETC-USDT" + "off_chain_ticker": "ETC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ETCUSDT" + "off_chain_ticker": "ETCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ETC-USDT" + "off_chain_ticker": "ETC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ETH/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETH", + "Quote": "USD" + }, + "decimals": 6, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ETHUSDT" + "off_chain_ticker": "ETHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ETHUSDT" + "off_chain_ticker": "ETHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "ETH-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "ETH-USD" - }, { "name": "huobi_ws", - "off_chain_ticker": "ethusdt" + "off_chain_ticker": "ethusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9560,71 +1656,119 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "ETH-USDT" + "off_chain_ticker": "ETH-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ETHUSDT" + "off_chain_ticker": "ETHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ETH-USDT" + "off_chain_ticker": "ETH-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "FET/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "FET", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "FETUSDT" + "off_chain_ticker": "FETUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "FET-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "FET-USD" - }, { "name": "kraken_api", "off_chain_ticker": "FETUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "FET-USDT" + "off_chain_ticker": "FET-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "FET-USDT" + "off_chain_ticker": "FET-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "FETUSDT" + "off_chain_ticker": "FETUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "FIL/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "FIL", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "FILUSDT" + "off_chain_ticker": "FILUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "FIL-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "FIL-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "FIL_USDT" + "off_chain_ticker": "FIL_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "filusdt" + "off_chain_ticker": "filusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9632,35 +1776,59 @@ }, { "name": "mexc_ws", - "off_chain_ticker": "FILUSDT" + "off_chain_ticker": "FILUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "FIL-USDT" + "off_chain_ticker": "FIL-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "GRT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "GRT", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "GRTUSDT" + "off_chain_ticker": "GRTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "GRTUSDT" + "off_chain_ticker": "GRTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "GRT-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "GRT-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "GRT_USDT" + "off_chain_ticker": "GRT_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9668,23 +1836,47 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "GRT-USDT" + "off_chain_ticker": "GRT-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "GRTUSDT" + "off_chain_ticker": "GRTUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "GRT-USDT" + "off_chain_ticker": "GRT-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "HBAR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "HBAR", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "HBARUSDT" + "off_chain_ticker": "HBARUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bitstamp_ws", @@ -9692,283 +1884,479 @@ }, { "name": "bybit_ws", - "off_chain_ticker": "HBARUSDT" + "off_chain_ticker": "HBARUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "HBAR-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "HBAR-USD" - }, { "name": "kucoin_ws", - "off_chain_ticker": "HBAR-USDT" + "off_chain_ticker": "HBAR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "HBARUSDT" + "off_chain_ticker": "HBARUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "HBAR-USDT" + "off_chain_ticker": "HBAR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ICP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ICP", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ICPUSDT" + "off_chain_ticker": "ICPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ICPUSDT" + "off_chain_ticker": "ICPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "ICP-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "ICP-USD" - }, { "name": "kraken_api", "off_chain_ticker": "ICPUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "ICP-USDT" + "off_chain_ticker": "ICP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ICP-USDT" + "off_chain_ticker": "ICP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ICPUSDT" + "off_chain_ticker": "ICPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "IMX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "IMX", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "IMXUSDT" + "off_chain_ticker": "IMXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "IMX-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "IMX-USD" - }, { "name": "kraken_api", "off_chain_ticker": "IMXUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "IMX-USDT" + "off_chain_ticker": "IMX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "IMXUSDT" + "off_chain_ticker": "IMXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "IMX-USDT" + "off_chain_ticker": "IMX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "INJ/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "INJ", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "INJUSDT" + "off_chain_ticker": "INJUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "INJUSDT" + "off_chain_ticker": "INJUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "INJ-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "INJ-USD" - }, { "name": "kraken_api", "off_chain_ticker": "INJUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "INJ-USDT" + "off_chain_ticker": "INJ-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "INJ-USDT" + "off_chain_ticker": "INJ-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "INJUSDT" + "off_chain_ticker": "INJUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "JTO/USD": { - "providers": [ - { - "name": "coinbase_api", - "off_chain_ticker": "JTO-USD" + "ticker": { + "currency_pair": { + "Base": "JTO", + "Quote": "USD" }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { - "name": "coinbase_ws", + "name": "coinbase_api", "off_chain_ticker": "JTO-USD" }, { "name": "binance_api", - "off_chain_ticker": "JTOUSDT" + "off_chain_ticker": "JTOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "JTOUSDT" + "off_chain_ticker": "JTOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "JTOUSDT" + "off_chain_ticker": "JTOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "JTO-USDT" + "off_chain_ticker": "JTO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "JTO-USDT" + "off_chain_ticker": "JTO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "JUP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "JUP", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "kucoin_ws", - "off_chain_ticker": "JUP-USDT" + "off_chain_ticker": "JUP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "JUP-USDT" + "off_chain_ticker": "JUP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "binance_api", - "off_chain_ticker": "JUPUSDT" + "off_chain_ticker": "JUPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "JUPUSDT" + "off_chain_ticker": "JUPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "JUP_USDT" + "off_chain_ticker": "JUP_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "JUPUSDT" + "off_chain_ticker": "JUPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "LDO/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LDO", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "LDOUSDT" + "off_chain_ticker": "LDOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "LDO-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "LDO-USD" - }, { "name": "kraken_api", "off_chain_ticker": "LDOUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "LDO-USDT" + "off_chain_ticker": "LDO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "LDOUSDT" + "off_chain_ticker": "LDOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "LDO-USDT" + "off_chain_ticker": "LDO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "LINK/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LINK", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "LINKUSDT" + "off_chain_ticker": "LINKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "LINKUSDT" + "off_chain_ticker": "LINKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "LINK-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "LINK-USD" - }, { "name": "kraken_api", "off_chain_ticker": "LINKUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "LINK-USDT" + "off_chain_ticker": "LINK-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "LINKUSDT" + "off_chain_ticker": "LINKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "LINK-USDT" + "off_chain_ticker": "LINK-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "LTC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LTC", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "LTCUSDT" + "off_chain_ticker": "LTCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "LTCUSDT" + "off_chain_ticker": "LTCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "LTC-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "LTC-USD" - }, { "name": "huobi_ws", - "off_chain_ticker": "ltcusdt" + "off_chain_ticker": "ltcusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -9976,35 +2364,59 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "LTC-USDT" + "off_chain_ticker": "LTC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "LTCUSDT" + "off_chain_ticker": "LTCUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "LTC-USDT" + "off_chain_ticker": "LTC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "MANA/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MANA", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "MANAUSDT" + "off_chain_ticker": "MANAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "MANA-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "MANA-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "MANA_USDT" + "off_chain_ticker": "MANA_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10012,43 +2424,75 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "MANA-USDT" + "off_chain_ticker": "MANA-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "MANAUSDT" + "off_chain_ticker": "MANAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "MANA-USDT" + "off_chain_ticker": "MANA-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "MATIC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MATIC", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "MATICUSDT" + "off_chain_ticker": "MATICUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "MATICUSDT" + "off_chain_ticker": "MATICUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "MATIC-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "MATIC-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "MATIC_USDT" + "off_chain_ticker": "MATIC_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "maticusdt" + "off_chain_ticker": "maticusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10056,163 +2500,303 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "MATIC-USDT" + "off_chain_ticker": "MATIC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "MATICUSDT" + "off_chain_ticker": "MATICUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "MATIC-USDT" + "off_chain_ticker": "MATIC-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "MKR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MKR", + "Quote": "USD" + }, + "decimals": 6, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "MKRUSDT" + "off_chain_ticker": "MKRUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "MKR-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "MKR-USD" - }, { "name": "kraken_api", "off_chain_ticker": "MKRUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "MKR-USDT" + "off_chain_ticker": "MKR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "MKRUSDT" + "off_chain_ticker": "MKRUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "MKR-USDT" + "off_chain_ticker": "MKR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "NEAR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "NEAR", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "NEARUSDT" + "off_chain_ticker": "NEARUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "NEAR-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "NEAR-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "NEAR_USDT" + "off_chain_ticker": "NEAR_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "nearusdt" + "off_chain_ticker": "nearusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "NEAR-USDT" + "off_chain_ticker": "NEAR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "NEARUSDT" + "off_chain_ticker": "NEARUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "NEAR-USDT" + "off_chain_ticker": "NEAR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "OP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "OP", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "OPUSDT" + "off_chain_ticker": "OPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "OP-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "OP-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "OP_USDT" + "off_chain_ticker": "OP_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "OP-USDT" + "off_chain_ticker": "OP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "OPUSDT" + "off_chain_ticker": "OPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "OP-USDT" + "off_chain_ticker": "OP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "ORDI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ORDI", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "ORDIUSDT" + "off_chain_ticker": "ORDIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "ORDIUSDT" + "off_chain_ticker": "ORDIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "ORDI_USDT" + "off_chain_ticker": "ORDI_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "ordiusdt" + "off_chain_ticker": "ordiusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "ORDI-USDT" + "off_chain_ticker": "ORDI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "ORDI-USDT" + "off_chain_ticker": "ORDI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "ORDIUSDT" + "off_chain_ticker": "ORDIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "PEPE/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "PEPE", + "Quote": "USD" + }, + "decimals": 16, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "PEPEUSDT" + "off_chain_ticker": "PEPEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "PEPEUSDT" + "off_chain_ticker": "PEPEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "PEPE_USDT" + "off_chain_ticker": "PEPE_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10220,87 +2804,167 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "PEPE-USDT" + "off_chain_ticker": "PEPE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "PEPEUSDT" + "off_chain_ticker": "PEPEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "PEPE-USDT" + "off_chain_ticker": "PEPE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "PYTH/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "PYTH", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "PYTHUSDT" + "off_chain_ticker": "PYTHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "PYTHUSDT" + "off_chain_ticker": "PYTHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "PYTH_USDT" + "off_chain_ticker": "PYTH_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "PYTH-USDT" + "off_chain_ticker": "PYTH-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "PYTH-USDT" + "off_chain_ticker": "PYTH-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "PYTHUSDT" + "off_chain_ticker": "PYTHUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "RNDR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "RNDR", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "RNDRUSDT" + "off_chain_ticker": "RNDRUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "RNDR-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "RNDR-USD" - }, { "name": "kraken_api", "off_chain_ticker": "RNDRUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "RNDR-USDT" + "off_chain_ticker": "RNDR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "RNDR-USDT" + "off_chain_ticker": "RNDR-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "RNDRUSDT" + "off_chain_ticker": "RNDRUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "RUNE/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "RUNE", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "RUNEUSDT" + "off_chain_ticker": "RUNEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "RUNE_USDT" + "off_chain_ticker": "RUNE_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10308,71 +2972,123 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "RUNE-USDT" + "off_chain_ticker": "RUNE-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "RUNEUSDT" + "off_chain_ticker": "RUNEUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "SEI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SEI", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "SEIUSDT" + "off_chain_ticker": "SEIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "SEIUSDT" + "off_chain_ticker": "SEIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "SEI-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "SEI-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "SEI_USDT" + "off_chain_ticker": "SEI_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "seiusdt" + "off_chain_ticker": "seiusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "SEI-USDT" + "off_chain_ticker": "SEI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "SEIUSDT" + "off_chain_ticker": "SEIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "SHIB/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SHIB", + "Quote": "USD" + }, + "decimals": 15, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "SHIBUSDT" + "off_chain_ticker": "SHIBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "SHIBUSDT" + "off_chain_ticker": "SHIBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "SHIB-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "SHIB-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "SHIB_USDT" + "off_chain_ticker": "SHIB_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10380,71 +3096,119 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "SHIB-USDT" + "off_chain_ticker": "SHIB-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "SHIBUSDT" + "off_chain_ticker": "SHIBUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "SHIB-USDT" + "off_chain_ticker": "SHIB-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "SNX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SNX", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "SNXUSDT" + "off_chain_ticker": "SNXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "SNXUSDT" + "off_chain_ticker": "SNXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "SNX-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "SNX-USD" - }, { "name": "kraken_api", "off_chain_ticker": "SNXUSD" }, { "name": "mexc_ws", - "off_chain_ticker": "SNXUSDT" + "off_chain_ticker": "SNXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "SNX-USDT" + "off_chain_ticker": "SNX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "SOL/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SOL", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "SOLUSDT" + "off_chain_ticker": "SOLUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "SOLUSDT" + "off_chain_ticker": "SOLUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "SOL-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "SOL-USD" - }, { "name": "huobi_ws", - "off_chain_ticker": "solusdt" + "off_chain_ticker": "solusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10452,27 +3216,55 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "SOL-USDT" + "off_chain_ticker": "SOL-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "SOLUSDT" + "off_chain_ticker": "SOLUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "SOL-USDT" + "off_chain_ticker": "SOL-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "STRK/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "STRK", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "STRKUSDT" + "off_chain_ticker": "STRKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "STRKUSDT" + "off_chain_ticker": "STRKUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10480,39 +3272,67 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "STRK-USDT" + "off_chain_ticker": "STRK-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "STRK-USDT" + "off_chain_ticker": "STRK-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "STRK_USDT" + "off_chain_ticker": "STRK_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "STX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "STX", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "STXUSDT" + "off_chain_ticker": "STXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "STXUSDT" + "off_chain_ticker": "STXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "STX-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "STX-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "STX_USDT" + "off_chain_ticker": "STX_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10520,79 +3340,139 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "STX-USDT" + "off_chain_ticker": "STX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "STX-USDT" + "off_chain_ticker": "STX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "STXUSDT" + "off_chain_ticker": "STXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "SUI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SUI", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "SUIUSDT" + "off_chain_ticker": "SUIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "SUIUSDT" + "off_chain_ticker": "SUIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "SUI-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "SUI-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "SUI_USDT" + "off_chain_ticker": "SUI_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "suiusdt" + "off_chain_ticker": "suiusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "SUI-USDT" + "off_chain_ticker": "SUI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "SUIUSDT" + "off_chain_ticker": "SUIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "SUI-USDT" + "off_chain_ticker": "SUI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "TIA/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "TIA", + "Quote": "USD" + }, + "decimals": 8, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "TIAUSDT" + "off_chain_ticker": "TIAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "TIAUSDT" + "off_chain_ticker": "TIAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "TIA-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "TIA-USD" - }, { "name": "huobi_ws", - "off_chain_ticker": "tiausdt" + "off_chain_ticker": "tiausdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10600,35 +3480,71 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "TIA-USDT" + "off_chain_ticker": "TIA-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "TIAUSDT" + "off_chain_ticker": "TIAUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "TIA-USDT" + "off_chain_ticker": "TIA-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "TRX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "TRX", + "Quote": "USD" + }, + "decimals": 11, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "TRXUSDT" + "off_chain_ticker": "TRXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "TRXUSDT" + "off_chain_ticker": "TRXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "TRX_USDT" + "off_chain_ticker": "TRX_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "trxusdt" + "off_chain_ticker": "trxusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10636,39 +3552,67 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "TRX-USDT" + "off_chain_ticker": "TRX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "TRXUSDT" + "off_chain_ticker": "TRXUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "TRX-USDT" + "off_chain_ticker": "TRX-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "UNI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "UNI", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "UNIUSDT" + "off_chain_ticker": "UNIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "UNIUSDT" + "off_chain_ticker": "UNIUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "UNI-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "UNI-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "UNI_USDT" + "off_chain_ticker": "UNI_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10676,159 +3620,300 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "UNI-USDT" + "off_chain_ticker": "UNI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "UNI-USDT" + "off_chain_ticker": "UNI-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "USDT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "USDT", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "USDCUSDT" + "off_chain_ticker": "USDCUSDT", + "invert": true }, { "name": "bybit_ws", - "off_chain_ticker": "USDCUSDT" + "off_chain_ticker": "USDCUSDT", + "invert": true }, { "name": "coinbase_api", "off_chain_ticker": "USDT-USD" }, { - "name": "coinbase_ws", - "off_chain_ticker": "USDT-USD" + "name": "huobi_ws", + "off_chain_ticker": "ethusdt", + "normalize_by_pair": { + "Base": "ETH", + "Quote": "USD" + }, + "invert": true }, { "name": "kraken_api", "off_chain_ticker": "USDTZUSD" }, + { + "name": "kucoin_ws", + "off_chain_ticker": "BTC-USDT", + "normalize_by_pair": { + "Base": "BTC", + "Quote": "USD" + }, + "invert": true + }, { "name": "okx_ws", - "off_chain_ticker": "USDC-USDT" + "off_chain_ticker": "USDC-USDT", + "invert": true } ] }, "WLD/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "WLD", + "Quote": "USD" + }, + "decimals": 9, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "WLDUSDT" + "off_chain_ticker": "WLDUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "WLDUSDT" + "off_chain_ticker": "WLDUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "WLD_USDT" + "off_chain_ticker": "WLD_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "wldusdt" + "off_chain_ticker": "wldusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "WLD-USDT" + "off_chain_ticker": "WLD-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "WLDUSDT" + "off_chain_ticker": "WLDUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "WLD-USDT" + "off_chain_ticker": "WLD-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "WOO/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "WOO", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "WOOUSDT" + "off_chain_ticker": "WOOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "gate_ws", - "off_chain_ticker": "WOO_USDT" + "off_chain_ticker": "WOO_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kucoin_ws", - "off_chain_ticker": "WOO-USDT" + "off_chain_ticker": "WOO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "WOO-USDT" + "off_chain_ticker": "WOO-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "WOOUSDT" + "off_chain_ticker": "WOOUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "XLM/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "XLM", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "XLMUSDT" + "off_chain_ticker": "XLMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "XLMUSDT" + "off_chain_ticker": "XLMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "XLM-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "XLM-USD" - }, { "name": "kraken_api", "off_chain_ticker": "XXLMZUSD" }, { "name": "kucoin_ws", - "off_chain_ticker": "XLM-USDT" + "off_chain_ticker": "XLM-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "XLMUSDT" + "off_chain_ticker": "XLMUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "XLM-USDT" + "off_chain_ticker": "XLM-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] }, "XRP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "XRP", + "Quote": "USD" + }, + "decimals": 10, + "min_provider_count": 3 + }, + "provider_configs": [ { "name": "binance_api", - "off_chain_ticker": "XRPUSDT" + "off_chain_ticker": "XRPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "bybit_ws", - "off_chain_ticker": "XRPUSDT" + "off_chain_ticker": "XRPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "coinbase_api", "off_chain_ticker": "XRP-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "XRP-USD" - }, { "name": "gate_ws", - "off_chain_ticker": "XRP_USDT" + "off_chain_ticker": "XRP_USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "huobi_ws", - "off_chain_ticker": "xrpusdt" + "off_chain_ticker": "xrpusdt", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "kraken_api", @@ -10836,18 +3921,29 @@ }, { "name": "kucoin_ws", - "off_chain_ticker": "XRP-USDT" + "off_chain_ticker": "XRP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "mexc_ws", - "off_chain_ticker": "XRPUSDT" + "off_chain_ticker": "XRPUSDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } }, { "name": "okx_ws", - "off_chain_ticker": "XRP-USDT" + "off_chain_ticker": "XRP-USDT", + "normalize_by_pair": { + "Base": "USDT", + "Quote": "USD" + } } ] } - }, - "aggregation_type": 1 + } } diff --git a/config/dydx/oracle.json b/config/dydx/oracle.json index 45cb6e0aa..5d15e8fbc 100644 --- a/config/dydx/oracle.json +++ b/config/dydx/oracle.json @@ -1,5 +1,5 @@ { - "updateInterval": 500000000, + "updateInterval": 250000000, "maxPriceAge": 120000000000, "providers": [ { diff --git a/config/local/market.json b/config/local/market.json index 7b9526d6b..2f54e166b 100644 --- a/config/local/market.json +++ b/config/local/market.json @@ -1,6508 +1,19 @@ { - "tickers": { + "markets": { "ADA/USD": { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ADA/USDC": { - "currency_pair": { - "Base": "ADA", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ADA/USDT": { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "APE/USD": { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "APE/USDC": { - "currency_pair": { - "Base": "APE", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "APE/USDT": { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "APT/USD": { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "APT/USDC": { - "currency_pair": { - "Base": "APT", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "APT/USDT": { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ARB/USD": { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ARB/USDT": { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ATOM/USD": { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ATOM/USDC": { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ATOM/USDT": { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "AVAX/USD": { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "AVAX/USDC": { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "AVAX/USDT": { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BCH/USD": { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BCH/USDT": { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BLUR/USD": { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BLUR/USDT": { - "currency_pair": { - "Base": "BLUR", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BTC/USD": { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BTC/USDC": { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "BTC/USDT": { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "COMP/USD": { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "COMP/USDT": { - "currency_pair": { - "Base": "COMP", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "CRV/USD": { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "CRV/USDT": { - "currency_pair": { - "Base": "CRV", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "DOGE/USD": { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "DOGE/USDT": { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "DOT/USD": { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "DOT/USDT": { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "DYDX/USD": { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "DYDX/USDC": { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "DYDX/USDT": { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ETC/USD": { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ETC/USDT": { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ETH/BTC": { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ETH/USD": { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ETH/USDC": { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "ETH/USDT": { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "FIL/USD": { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "FIL/USDT": { - "currency_pair": { - "Base": "FIL", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "LDO/USD": { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "LDO/USDT": { - "currency_pair": { - "Base": "LDO", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "LINK/USD": { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "LINK/USDT": { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "LTC/USD": { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "LTC/USDT": { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "MATIC/USD": { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "MATIC/USDT": { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "MKR/USD": { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "MKR/USDT": { - "currency_pair": { - "Base": "MKR", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "MOG/USD": { - "currency_pair": { - "Base": "MOG", - "Quote": "USD" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "NEAR/USD": { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "NEAR/USDT": { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "OP/USD": { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "OP/USDT": { - "currency_pair": { - "Base": "OP", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "OSMO/USD": { - "currency_pair": { - "Base": "OSMO", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "OSMO/USDC": { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "OSMO/USDT": { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "PEPE/USD": { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "PEPE/USDT": { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "SEI/USD": { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "SEI/USDT": { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "SHIB/USD": { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "SHIB/USDT": { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "decimals": 18, - "min_provider_count": 1 - }, - "SOL/USD": { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "SOL/USDC": { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "SOL/USDT": { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "SUI/USD": { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "SUI/USDT": { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "TIA/USD": { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "TIA/USDC": { - "currency_pair": { - "Base": "TIA", - "Quote": "USDC" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "TIA/USDT": { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "TRX/USD": { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "TRX/USDT": { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "UNI/USD": { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "UNI/USDT": { - "currency_pair": { - "Base": "UNI", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "USDC/USD": { - "currency_pair": { - "Base": "USDC", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "USDC/USDT": { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "USDT/USD": { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "WLD/USDT": { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "XLM/USD": { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "XLM/USDT": { - "currency_pair": { - "Base": "XLM", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "XRP/USD": { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "decimals": 8, - "min_provider_count": 1 - }, - "XRP/USDT": { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "decimals": 8, - "min_provider_count": 1 - } - }, - "paths": { - "ADA/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "ADA/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ADA/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ADA", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "APE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "APE/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - } - ] - }, - "APE/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APE", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "APT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "APT/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - } - ] - }, - "APT/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "APT", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ARB/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "ARB/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ARB", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ATOM/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "ATOM/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ATOM/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ATOM", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "AVAX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "AVAX/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDC" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "AVAX/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "AVAX", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "BCH/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "BCH/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BCH", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "BLUR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "BLUR/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BLUR", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "BTC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "bitfinex_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "BTC/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "BTC/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "COMP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "COMP/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "COMP", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "CRV/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "CRV/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "CRV", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "DOGE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "DOGE/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOGE", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "DOT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "DOT/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DOT", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "DYDX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "DYDX/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - } - ] - }, - "DYDX/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "DYDX", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ETC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "ETC/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETC", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ETH/BTC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "bitfinex_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "BTC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ETH/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "bitfinex_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "ETH/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "ETH/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "ETH", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "FIL/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "FIL/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "FIL", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "LDO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "LDO/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LDO", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "LINK/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "LINK/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LINK", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "LTC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "LTC/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "LTC", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "MATIC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "MATIC/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MATIC", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "MKR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "MKR/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "MKR", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "MOG/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "MOG", - "Quote": "USD" - }, - "provider": "gecko_terminal_api" - } - ] - } - ] - }, - "NEAR/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "NEAR/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "NEAR", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "OP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "OP/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OP", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "OSMO/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "OSMO/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDC" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "OSMO/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "OSMO", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "PEPE/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "gecko_terminal_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - } - ] - }, - "PEPE/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "PEPE", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "SEI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "SEI/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SEI", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "SHIB/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "SHIB/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SHIB", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "SOL/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "bitfinex_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "SOL/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDC" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "SOL/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SOL", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "SUI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "SUI/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "SUI", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "TIA/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "coingecko_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "bitfinex_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "TIA/USDC": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDC" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDC" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "TIA/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TIA", - "Quote": "USDT" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "TRX/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - } - ] - }, - "TRX/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "TRX", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "UNI/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "UNI/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "UNI", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - } - ] - }, - "USDC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - } - ] - }, - "USDC/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDC", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "USDT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "bitstamp_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "crypto_dot_com_ws" - } - ] - } - ] - }, - "WLD/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "WLD", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "XLM/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "XLM/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XLM", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - }, - "XRP/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "kraken_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "coinbase_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USD" - }, - "provider": "coinbase_ws" - } - ] - } - ] - }, - "XRP/USDT": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "bybit_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "okx_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "kraken_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "huobi_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "kucoin_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "binance_api" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "gate_ws" - } - ] - }, - { - "operations": [ - { - "currency_pair": { - "Base": "XRP", - "Quote": "USDT" - }, - "provider": "mexc_ws" - } - ] - } - ] - } - }, - "providers": { - "ADA/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ADA", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "ADA/USD" }, - { - "name": "okx_ws", - "off_chain_ticker": "ADA-USD" - }, { "name": "kraken_api", "off_chain_ticker": "ADAUSD" @@ -6514,42 +25,62 @@ { "name": "coinbase_ws", "off_chain_ticker": "ADA-USD" + }, + { + "name": "okx_ws", + "off_chain_ticker": "ADA-USD" } ] }, "ADA/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ADA", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "ADA-USDC" + "name": "mexc_ws", + "off_chain_ticker": "ADAUSDC" }, { "name": "kucoin_ws", "off_chain_ticker": "ADA-USDC" }, { - "name": "mexc_ws", - "off_chain_ticker": "ADAUSDC" + "name": "okx_ws", + "off_chain_ticker": "ADA-USDC" } ] }, "ADA/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ADA", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "ADAUSDT" + "name": "huobi_ws", + "off_chain_ticker": "adausdt" }, { - "name": "okx_ws", - "off_chain_ticker": "ADA-USDT" + "name": "mexc_ws", + "off_chain_ticker": "ADAUSDT" }, { "name": "kraken_api", "off_chain_ticker": "ADAUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "adausdt" + "name": "gate_ws", + "off_chain_ticker": "ADA_USDT" }, { "name": "kucoin_ws", @@ -6560,17 +91,25 @@ "off_chain_ticker": "ADAUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "ADA_USDT" + "name": "bybit_ws", + "off_chain_ticker": "ADAUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "ADAUSDT" + "name": "okx_ws", + "off_chain_ticker": "ADA-USDT" } ] }, "APE/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APE", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "APE/USD" @@ -6586,9 +125,17 @@ ] }, "APE/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APE", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", + "name": "coinbase_api", "off_chain_ticker": "APE-USDC" }, { @@ -6596,21 +143,37 @@ "off_chain_ticker": "APE-USDC" }, { - "name": "coinbase_api", + "name": "okx_ws", "off_chain_ticker": "APE-USDC" } ] }, "APE/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APE", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "APE-USDT" + "name": "mexc_ws", + "off_chain_ticker": "APEUSDT" }, { "name": "kraken_api", "off_chain_ticker": "APEUSDT" }, + { + "name": "gate_ws", + "off_chain_ticker": "APE_USDT" + }, + { + "name": "coinbase_api", + "off_chain_ticker": "APE-USDT" + }, { "name": "kucoin_ws", "off_chain_ticker": "APE-USDT" @@ -6619,26 +182,26 @@ "name": "binance_api", "off_chain_ticker": "APEUSDT" }, - { - "name": "coinbase_api", - "off_chain_ticker": "APE-USDT" - }, { "name": "coinbase_ws", "off_chain_ticker": "APE-USDT" }, { - "name": "gate_ws", - "off_chain_ticker": "APE_USDT" - }, - { - "name": "mexc_ws", - "off_chain_ticker": "APEUSDT" + "name": "okx_ws", + "off_chain_ticker": "APE-USDT" } ] }, "APT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APT", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "APTUSD" @@ -6654,7 +217,15 @@ ] }, "APT/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APT", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "okx_ws", "off_chain_ticker": "APT-USDC" @@ -6662,18 +233,26 @@ ] }, "APT/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "APT", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "APTUSDT" + "name": "huobi_ws", + "off_chain_ticker": "aptusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "APT-USDT" + "name": "mexc_ws", + "off_chain_ticker": "APTUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "aptusdt" + "name": "gate_ws", + "off_chain_ticker": "APT_USDT" }, { "name": "kucoin_ws", @@ -6684,17 +263,25 @@ "off_chain_ticker": "APTUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "APT_USDT" + "name": "bybit_ws", + "off_chain_ticker": "APTUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "APTUSDT" + "name": "okx_ws", + "off_chain_ticker": "APT-USDT" } ] }, "ARB/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ARB", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "ARBUSD" @@ -6710,18 +297,26 @@ ] }, "ARB/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ARB", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "ARBUSDT" + "name": "huobi_ws", + "off_chain_ticker": "arbusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "ARB-USDT" + "name": "mexc_ws", + "off_chain_ticker": "ARBUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "arbusdt" + "name": "gate_ws", + "off_chain_ticker": "ARB_USDT" }, { "name": "kucoin_ws", @@ -6732,17 +327,25 @@ "off_chain_ticker": "ARBUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "ARB_USDT" + "name": "bybit_ws", + "off_chain_ticker": "ARBUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "ARBUSDT" + "name": "okx_ws", + "off_chain_ticker": "ARB-USDT" } ] }, "ATOM/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ATOM", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "cosmos/usd" @@ -6751,10 +354,6 @@ "name": "kraken_ws", "off_chain_ticker": "ATOM/USD" }, - { - "name": "okx_ws", - "off_chain_ticker": "ATOM-USD" - }, { "name": "kraken_api", "off_chain_ticker": "ATOMUSD" @@ -6763,93 +362,121 @@ "name": "coinbase_api", "off_chain_ticker": "ATOM-USD" }, + { + "name": "crypto_dot_com_ws", + "off_chain_ticker": "ATOMUSD-PERP" + }, { "name": "coinbase_ws", "off_chain_ticker": "ATOM-USD" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "ATOMUSD-PERP" + "name": "okx_ws", + "off_chain_ticker": "ATOM-USD" } ] }, "ATOM/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ATOM", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "ATOM-USDC" + "name": "mexc_ws", + "off_chain_ticker": "ATOMUSDC" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "ATOM-USDC" }, { - "name": "coinbase_api", + "name": "kucoin_ws", "off_chain_ticker": "ATOM-USDC" }, { - "name": "mexc_ws", - "off_chain_ticker": "ATOMUSDC" + "name": "okx_ws", + "off_chain_ticker": "ATOM-USDC" } ] }, "ATOM/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ATOM", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "ATOMUSDT" + "name": "huobi_ws", + "off_chain_ticker": "atomusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "ATOM-USDT" + "name": "mexc_ws", + "off_chain_ticker": "ATOMUSDT" }, { "name": "kraken_api", "off_chain_ticker": "ATOMUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "atomusdt" + "name": "gate_ws", + "off_chain_ticker": "ATOM_USDT" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "ATOM-USDT" }, { - "name": "binance_api", - "off_chain_ticker": "ATOMUSDT" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "ATOM_USDT" }, { - "name": "coinbase_api", + "name": "kucoin_ws", "off_chain_ticker": "ATOM-USDT" }, { - "name": "coinbase_ws", - "off_chain_ticker": "ATOM-USDT" + "name": "binance_api", + "off_chain_ticker": "ATOMUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "ATOM_USDT" + "name": "bybit_ws", + "off_chain_ticker": "ATOMUSDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "ATOM_USDT" + "name": "coinbase_ws", + "off_chain_ticker": "ATOM-USDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "ATOMUSDT" + "name": "okx_ws", + "off_chain_ticker": "ATOM-USDT" } ] }, "AVAX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AVAX", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "kraken_ws", - "off_chain_ticker": "AVAX/USD" + "name": "bitstamp_ws", + "off_chain_ticker": "avaxusd" }, { - "name": "okx_ws", - "off_chain_ticker": "AVAX-USD" + "name": "kraken_ws", + "off_chain_ticker": "AVAX/USD" }, { "name": "kraken_api", @@ -6860,27 +487,35 @@ "off_chain_ticker": "AVAX-USD" }, { - "name": "coinbase_ws", - "off_chain_ticker": "AVAX-USD" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "AVAXUSD-PERP" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "avaxusd" + "name": "coinbase_ws", + "off_chain_ticker": "AVAX-USD" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "AVAXUSD-PERP" + "name": "okx_ws", + "off_chain_ticker": "AVAX-USD" } ] }, "AVAX/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AVAX", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", + "name": "mexc_ws", "off_chain_ticker": "AVAXUSDC" }, { - "name": "okx_ws", + "name": "coinbase_api", "off_chain_ticker": "AVAX-USDC" }, { @@ -6888,69 +523,85 @@ "off_chain_ticker": "AVAX-USDC" }, { - "name": "coinbase_api", - "off_chain_ticker": "AVAX-USDC" + "name": "bybit_ws", + "off_chain_ticker": "AVAXUSDC" }, { - "name": "mexc_ws", - "off_chain_ticker": "AVAXUSDC" + "name": "okx_ws", + "off_chain_ticker": "AVAX-USDC" } ] }, "AVAX/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "AVAX", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "AVAXUSDT" + "name": "huobi_ws", + "off_chain_ticker": "avaxusdt" }, { "name": "kraken_ws", "off_chain_ticker": "AVAX/USDT" }, { - "name": "okx_ws", - "off_chain_ticker": "AVAX-USDT" + "name": "mexc_ws", + "off_chain_ticker": "AVAXUSDT" }, { "name": "kraken_api", "off_chain_ticker": "AVAXUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "avaxusdt" + "name": "gate_ws", + "off_chain_ticker": "AVAX_USDT" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "AVAX-USDT" }, { - "name": "binance_api", - "off_chain_ticker": "AVAXUSDT" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "AVAX_USDT" }, { - "name": "coinbase_api", + "name": "kucoin_ws", "off_chain_ticker": "AVAX-USDT" }, { - "name": "coinbase_ws", - "off_chain_ticker": "AVAX-USDT" + "name": "binance_api", + "off_chain_ticker": "AVAXUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "AVAX_USDT" + "name": "bybit_ws", + "off_chain_ticker": "AVAXUSDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "AVAX_USDT" + "name": "coinbase_ws", + "off_chain_ticker": "AVAX-USDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "AVAXUSDT" + "name": "okx_ws", + "off_chain_ticker": "AVAX-USDT" } ] }, "BCH/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BCH", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "BCH/USD" @@ -6970,22 +621,30 @@ ] }, "BCH/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BCH", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "BCHUSDT" + "name": "huobi_ws", + "off_chain_ticker": "bchusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "BCH-USDT" + "name": "mexc_ws", + "off_chain_ticker": "BCHUSDT" }, { "name": "kraken_api", "off_chain_ticker": "BCHUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "bchusdt" + "name": "gate_ws", + "off_chain_ticker": "BCH_USDT" }, { "name": "kucoin_ws", @@ -6996,17 +655,25 @@ "off_chain_ticker": "BCHUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "BCH_USDT" + "name": "bybit_ws", + "off_chain_ticker": "BCHUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "BCHUSDT" + "name": "okx_ws", + "off_chain_ticker": "BCH-USDT" } ] }, "BLUR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BLUR", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "BLUR/USD" @@ -7022,38 +689,54 @@ ] }, "BLUR/USDT": { - "providers": [ - { - "name": "okx_ws", - "off_chain_ticker": "BLUR-USDT" + "ticker": { + "currency_pair": { + "Base": "BLUR", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "kucoin_ws", - "off_chain_ticker": "BLUR-USDT" + "name": "mexc_ws", + "off_chain_ticker": "BLURUSDT" }, { "name": "gate_ws", "off_chain_ticker": "BLUR_USDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "BLURUSDT" + "name": "kucoin_ws", + "off_chain_ticker": "BLUR-USDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "BLUR-USDT" } ] }, "BTC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BTC", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "bitcoin/usd" }, { - "name": "kraken_ws", - "off_chain_ticker": "XBT/USD" + "name": "bitstamp_ws", + "off_chain_ticker": "btcusd" }, { - "name": "okx_ws", - "off_chain_ticker": "BTC-USD" + "name": "kraken_ws", + "off_chain_ticker": "XBT/USD" }, { "name": "kraken_api", @@ -7064,44 +747,56 @@ "off_chain_ticker": "BTC-USD" }, { - "name": "coinbase_ws", - "off_chain_ticker": "BTC-USD" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "BTCUSD-PERP" }, { "name": "bitfinex_ws", "off_chain_ticker": "BTCUSD" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "btcusd" + "name": "coinbase_ws", + "off_chain_ticker": "BTC-USD" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "BTCUSD-PERP" + "name": "okx_ws", + "off_chain_ticker": "BTC-USD" } ] }, "BTC/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BTC", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "BTCUSDC" + "name": "bitstamp_ws", + "off_chain_ticker": "btcusdc" + }, + { + "name": "huobi_ws", + "off_chain_ticker": "btcusdc" }, { "name": "kraken_ws", "off_chain_ticker": "XBT/USDC" }, { - "name": "okx_ws", - "off_chain_ticker": "BTC-USDC" + "name": "mexc_ws", + "off_chain_ticker": "BTCUSDC" }, { "name": "kraken_api", "off_chain_ticker": "XBTUSDC" }, { - "name": "huobi_ws", - "off_chain_ticker": "btcusdc" + "name": "coinbase_api", + "off_chain_ticker": "BTC-USDC" }, { "name": "kucoin_ws", @@ -7112,77 +807,89 @@ "off_chain_ticker": "BTCUSDC" }, { - "name": "coinbase_api", - "off_chain_ticker": "BTC-USDC" - }, - { - "name": "bitstamp_ws", - "off_chain_ticker": "btcusdc" + "name": "bybit_ws", + "off_chain_ticker": "BTCUSDC" }, { - "name": "mexc_ws", - "off_chain_ticker": "BTCUSDC" + "name": "okx_ws", + "off_chain_ticker": "BTC-USDC" } ] }, "BTC/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "BTC", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "BTCUSDT" + "name": "bitstamp_ws", + "off_chain_ticker": "btcusdt" + }, + { + "name": "huobi_ws", + "off_chain_ticker": "btcusdt" }, { "name": "kraken_ws", "off_chain_ticker": "XBT/USDT" }, { - "name": "okx_ws", - "off_chain_ticker": "BTC-USDT" + "name": "mexc_ws", + "off_chain_ticker": "BTCUSDT" }, { "name": "kraken_api", "off_chain_ticker": "XBTUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "btcusdt" + "name": "gate_ws", + "off_chain_ticker": "BTC_USDT" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "BTC-USDT" }, { - "name": "binance_api", - "off_chain_ticker": "BTCUSDT" - }, - { - "name": "coinbase_api", - "off_chain_ticker": "BTC-USDT" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "BTC_USDT" }, { - "name": "coinbase_ws", + "name": "kucoin_ws", "off_chain_ticker": "BTC-USDT" }, { - "name": "gate_ws", - "off_chain_ticker": "BTC_USDT" + "name": "binance_api", + "off_chain_ticker": "BTCUSDT" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "btcusdt" + "name": "bybit_ws", + "off_chain_ticker": "BTCUSDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "BTC_USDT" + "name": "coinbase_ws", + "off_chain_ticker": "BTC-USDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "BTCUSDT" + "name": "okx_ws", + "off_chain_ticker": "BTC-USDT" } ] }, "COMP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "COMP", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "COMP/USD" @@ -7202,13 +909,17 @@ ] }, "COMP/USDT": { - "providers": [ - { - "name": "okx_ws", - "off_chain_ticker": "COMP-USDT" + "ticker": { + "currency_pair": { + "Base": "COMP", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "binance_api", + "name": "mexc_ws", "off_chain_ticker": "COMPUSDT" }, { @@ -7216,13 +927,25 @@ "off_chain_ticker": "COMP_USDT" }, { - "name": "mexc_ws", + "name": "binance_api", "off_chain_ticker": "COMPUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "COMP-USDT" } ] }, "CRV/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "CRV", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "CRV/USD" @@ -7242,10 +965,22 @@ ] }, "CRV/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "CRV", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "CRV-USDT" + "name": "mexc_ws", + "off_chain_ticker": "CRVUSDT" + }, + { + "name": "gate_ws", + "off_chain_ticker": "CRV_USDT" }, { "name": "kucoin_ws", @@ -7256,17 +991,21 @@ "off_chain_ticker": "CRVUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "CRV_USDT" - }, - { - "name": "mexc_ws", - "off_chain_ticker": "CRVUSDT" + "name": "okx_ws", + "off_chain_ticker": "CRV-USDT" } ] }, "DOGE/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DOGE", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "XDG/USD" @@ -7286,22 +1025,30 @@ ] }, "DOGE/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DOGE", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "DOGEUSDT" + "name": "huobi_ws", + "off_chain_ticker": "dogeusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "DOGE-USDT" + "name": "mexc_ws", + "off_chain_ticker": "DOGEUSDT" }, { "name": "kraken_api", "off_chain_ticker": "XDGUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "dogeusdt" + "name": "gate_ws", + "off_chain_ticker": "DOGE_USDT" }, { "name": "kucoin_ws", @@ -7312,17 +1059,25 @@ "off_chain_ticker": "DOGEUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "DOGE_USDT" + "name": "bybit_ws", + "off_chain_ticker": "DOGEUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "DOGEUSDT" + "name": "okx_ws", + "off_chain_ticker": "DOGE-USDT" } ] }, "DOT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DOT", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "DOT/USD" @@ -7342,19 +1097,27 @@ ] }, "DOT/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "DOTUSDT" + "ticker": { + "currency_pair": { + "Base": "DOT", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "DOT-USDT" + "name": "mexc_ws", + "off_chain_ticker": "DOTUSDT" }, { "name": "kraken_api", "off_chain_ticker": "DOTUSDT" }, + { + "name": "gate_ws", + "off_chain_ticker": "DOT_USDT" + }, { "name": "kucoin_ws", "off_chain_ticker": "DOT-USDT" @@ -7364,17 +1127,25 @@ "off_chain_ticker": "DOTUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "DOT_USDT" + "name": "bybit_ws", + "off_chain_ticker": "DOTUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "DOTUSDT" + "name": "okx_ws", + "off_chain_ticker": "DOT-USDT" } ] }, "DYDX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DYDX", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "dydx-chain/usd" @@ -7383,10 +1154,6 @@ "name": "kraken_ws", "off_chain_ticker": "DYDX/USD" }, - { - "name": "okx_ws", - "off_chain_ticker": "DYDX-USD" - }, { "name": "kraken_api", "off_chain_ticker": "DYDXUSD" @@ -7398,11 +1165,23 @@ { "name": "crypto_dot_com_ws", "off_chain_ticker": "DYDXUSD-PERP" + }, + { + "name": "okx_ws", + "off_chain_ticker": "DYDX-USD" } ] }, "DYDX/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "DYDX", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coinbase_api", "off_chain_ticker": "DYDX-USDC" @@ -7410,47 +1189,63 @@ ] }, "DYDX/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "DYDXUSDT" - }, - { - "name": "okx_ws", - "off_chain_ticker": "DYDX-USDT" + "ticker": { + "currency_pair": { + "Base": "DYDX", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "huobi_ws", "off_chain_ticker": "dydxusdt" }, { - "name": "kucoin_ws", - "off_chain_ticker": "DYDX-USDT" + "name": "mexc_ws", + "off_chain_ticker": "DYDXUSDT" }, { - "name": "binance_api", - "off_chain_ticker": "DYDXUSDT" + "name": "gate_ws", + "off_chain_ticker": "DYDX_USDT" }, { "name": "coinbase_api", "off_chain_ticker": "DYDX-USDT" }, { - "name": "gate_ws", + "name": "crypto_dot_com_ws", "off_chain_ticker": "DYDX_USDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "DYDX_USDT" + "name": "kucoin_ws", + "off_chain_ticker": "DYDX-USDT" }, { - "name": "mexc_ws", + "name": "binance_api", + "off_chain_ticker": "DYDXUSDT" + }, + { + "name": "bybit_ws", "off_chain_ticker": "DYDXUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "DYDX-USDT" } ] }, "ETC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETC", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "ETCUSD" @@ -7466,21 +1261,21 @@ ] }, "ETC/USDT": { - "providers": [ - { - "name": "okx_ws", - "off_chain_ticker": "ETC-USDT" + "ticker": { + "currency_pair": { + "Base": "ETC", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "huobi_ws", "off_chain_ticker": "etcusdt" }, { - "name": "kucoin_ws", - "off_chain_ticker": "ETC-USDT" - }, - { - "name": "binance_api", + "name": "mexc_ws", "off_chain_ticker": "ETCUSDT" }, { @@ -7488,84 +1283,108 @@ "off_chain_ticker": "ETC_USDT" }, { - "name": "mexc_ws", + "name": "kucoin_ws", + "off_chain_ticker": "ETC-USDT" + }, + { + "name": "binance_api", "off_chain_ticker": "ETCUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "ETC-USDT" } ] }, "ETH/BTC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETH", + "Quote": "BTC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "ethereum/btc" }, + { + "name": "bitstamp_ws", + "off_chain_ticker": "ethbtc" + }, + { + "name": "huobi_ws", + "off_chain_ticker": "ethbtc" + }, { "name": "kraken_ws", "off_chain_ticker": "ETH/XBT" }, { - "name": "okx_ws", - "off_chain_ticker": "ETH-BTC" + "name": "mexc_ws", + "off_chain_ticker": "ETHBTC" }, { "name": "kraken_api", "off_chain_ticker": "XETHXXBT" }, { - "name": "huobi_ws", - "off_chain_ticker": "ethbtc" + "name": "gate_ws", + "off_chain_ticker": "ETH_BTC" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "ETH-BTC" }, { - "name": "binance_api", - "off_chain_ticker": "ETHBTC" - }, - { - "name": "coinbase_api", - "off_chain_ticker": "ETH-BTC" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "ETH_BTC" }, { - "name": "coinbase_ws", + "name": "kucoin_ws", "off_chain_ticker": "ETH-BTC" }, { - "name": "gate_ws", - "off_chain_ticker": "ETH_BTC" + "name": "binance_api", + "off_chain_ticker": "ETHBTC" }, { "name": "bitfinex_ws", "off_chain_ticker": "ETHBTC" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "ethbtc" - }, - { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "ETH_BTC" + "name": "coinbase_ws", + "off_chain_ticker": "ETH-BTC" }, { - "name": "mexc_ws", - "off_chain_ticker": "ETHBTC" + "name": "okx_ws", + "off_chain_ticker": "ETH-BTC" } ] }, "ETH/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETH", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "ethereum/usd" }, { - "name": "kraken_ws", - "off_chain_ticker": "ETH/USD" + "name": "bitstamp_ws", + "off_chain_ticker": "ethusd" }, { - "name": "okx_ws", - "off_chain_ticker": "ETH-USD" + "name": "kraken_ws", + "off_chain_ticker": "ETH/USD" }, { "name": "kraken_api", @@ -7576,44 +1395,52 @@ "off_chain_ticker": "ETH-USD" }, { - "name": "coinbase_ws", - "off_chain_ticker": "ETH-USD" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "ETHUSD-PERP" }, { "name": "bitfinex_ws", "off_chain_ticker": "ETHUSD" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "ethusd" + "name": "coinbase_ws", + "off_chain_ticker": "ETH-USD" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "ETHUSD-PERP" + "name": "okx_ws", + "off_chain_ticker": "ETH-USD" } ] }, "ETH/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETH", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "ETHUSDC" + "name": "huobi_ws", + "off_chain_ticker": "ethusdc" }, { "name": "kraken_ws", "off_chain_ticker": "ETH/USDC" }, { - "name": "okx_ws", - "off_chain_ticker": "ETH-USDC" + "name": "mexc_ws", + "off_chain_ticker": "ETHUSDC" }, { "name": "kraken_api", "off_chain_ticker": "ETHUSDC" }, { - "name": "huobi_ws", - "off_chain_ticker": "ethusdc" + "name": "coinbase_api", + "off_chain_ticker": "ETH-USDC" }, { "name": "kucoin_ws", @@ -7624,69 +1451,85 @@ "off_chain_ticker": "ETHUSDC" }, { - "name": "coinbase_api", - "off_chain_ticker": "ETH-USDC" + "name": "bybit_ws", + "off_chain_ticker": "ETHUSDC" }, { - "name": "mexc_ws", - "off_chain_ticker": "ETHUSDC" + "name": "okx_ws", + "off_chain_ticker": "ETH-USDC" } ] }, "ETH/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "ETH", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "ETHUSDT" + "name": "huobi_ws", + "off_chain_ticker": "ethusdt" }, { "name": "kraken_ws", "off_chain_ticker": "ETH/USDT" }, { - "name": "okx_ws", - "off_chain_ticker": "ETH-USDT" + "name": "mexc_ws", + "off_chain_ticker": "ETHUSDT" }, { "name": "kraken_api", "off_chain_ticker": "ETHUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "ethusdt" + "name": "gate_ws", + "off_chain_ticker": "ETH_USDT" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "ETH-USDT" }, { - "name": "binance_api", - "off_chain_ticker": "ETHUSDT" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "ETH_USDT" }, { - "name": "coinbase_api", + "name": "kucoin_ws", "off_chain_ticker": "ETH-USDT" }, { - "name": "coinbase_ws", - "off_chain_ticker": "ETH-USDT" + "name": "binance_api", + "off_chain_ticker": "ETHUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "ETH_USDT" + "name": "bybit_ws", + "off_chain_ticker": "ETHUSDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "ETH_USDT" + "name": "coinbase_ws", + "off_chain_ticker": "ETH-USDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "ETHUSDT" + "name": "okx_ws", + "off_chain_ticker": "ETH-USDT" } ] }, "FIL/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "FIL", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "FIL/USD" @@ -7706,17 +1549,21 @@ ] }, "FIL/USDT": { - "providers": [ - { - "name": "okx_ws", - "off_chain_ticker": "FIL-USDT" + "ticker": { + "currency_pair": { + "Base": "FIL", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "huobi_ws", "off_chain_ticker": "filusdt" }, { - "name": "binance_api", + "name": "mexc_ws", "off_chain_ticker": "FILUSDT" }, { @@ -7724,13 +1571,25 @@ "off_chain_ticker": "FIL_USDT" }, { - "name": "mexc_ws", + "name": "binance_api", "off_chain_ticker": "FILUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "FIL-USDT" } ] }, "LDO/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LDO", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "LDO/USD" @@ -7750,10 +1609,18 @@ ] }, "LDO/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LDO", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "LDO-USDT" + "name": "mexc_ws", + "off_chain_ticker": "LDOUSDT" }, { "name": "kucoin_ws", @@ -7764,13 +1631,21 @@ "off_chain_ticker": "LDOUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "LDOUSDT" + "name": "okx_ws", + "off_chain_ticker": "LDO-USDT" } ] }, "LINK/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LINK", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "LINK/USD" @@ -7790,14 +1665,18 @@ ] }, "LINK/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "LINKUSDT" + "ticker": { + "currency_pair": { + "Base": "LINK", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "LINK-USDT" + "name": "mexc_ws", + "off_chain_ticker": "LINKUSDT" }, { "name": "kraken_api", @@ -7812,13 +1691,25 @@ "off_chain_ticker": "LINKUSDT" }, { - "name": "mexc_ws", + "name": "bybit_ws", "off_chain_ticker": "LINKUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "LINK-USDT" } ] }, "LTC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "LTC", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "XLTCZ/USD" @@ -7838,22 +1729,26 @@ ] }, "LTC/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "LTCUSDT" + "ticker": { + "currency_pair": { + "Base": "LTC", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "LTC-USDT" + "name": "huobi_ws", + "off_chain_ticker": "ltcusdt" }, { - "name": "kraken_api", + "name": "mexc_ws", "off_chain_ticker": "LTCUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "ltcusdt" + "name": "kraken_api", + "off_chain_ticker": "LTCUSDT" }, { "name": "kucoin_ws", @@ -7864,13 +1759,25 @@ "off_chain_ticker": "LTCUSDT" }, { - "name": "mexc_ws", + "name": "bybit_ws", "off_chain_ticker": "LTCUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "LTC-USDT" } ] }, "MATIC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MATIC", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "MATIC/USD" @@ -7890,22 +1797,30 @@ ] }, "MATIC/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MATIC", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "MATICUSDT" + "name": "huobi_ws", + "off_chain_ticker": "maticusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "MATIC-USDT" + "name": "mexc_ws", + "off_chain_ticker": "MATICUSDT" }, { "name": "kraken_api", "off_chain_ticker": "MATICUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "maticusdt" + "name": "gate_ws", + "off_chain_ticker": "MATIC_USDT" }, { "name": "kucoin_ws", @@ -7916,17 +1831,25 @@ "off_chain_ticker": "MATICUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "MATIC_USDT" + "name": "bybit_ws", + "off_chain_ticker": "MATICUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "MATICUSDT" + "name": "okx_ws", + "off_chain_ticker": "MATIC-USDT" } ] }, "MKR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MKR", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "MKR/USD" @@ -7946,10 +1869,18 @@ ] }, "MKR/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MKR", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "MKR-USDT" + "name": "mexc_ws", + "off_chain_ticker": "MKRUSDT" }, { "name": "kucoin_ws", @@ -7960,13 +1891,21 @@ "off_chain_ticker": "MKRUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "MKRUSDT" + "name": "okx_ws", + "off_chain_ticker": "MKR-USDT" } ] }, "MOG/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "MOG", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "gecko_terminal_api", "off_chain_ticker": "0xaaee1a9723aadb7afa2810263653a34ba2c21c7a" @@ -7974,7 +1913,15 @@ ] }, "NEAR/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "NEAR", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "NEARUSD" @@ -7990,21 +1937,21 @@ ] }, "NEAR/USDT": { - "providers": [ - { - "name": "okx_ws", - "off_chain_ticker": "NEAR-USDT" + "ticker": { + "currency_pair": { + "Base": "NEAR", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "huobi_ws", "off_chain_ticker": "nearusdt" }, { - "name": "kucoin_ws", - "off_chain_ticker": "NEAR-USDT" - }, - { - "name": "binance_api", + "name": "mexc_ws", "off_chain_ticker": "NEARUSDT" }, { @@ -8012,13 +1959,29 @@ "off_chain_ticker": "NEAR_USDT" }, { - "name": "mexc_ws", + "name": "kucoin_ws", + "off_chain_ticker": "NEAR-USDT" + }, + { + "name": "binance_api", "off_chain_ticker": "NEARUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "NEAR-USDT" } ] }, "OP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "OP", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "OPUSD" @@ -8034,10 +1997,22 @@ ] }, "OP/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "OP", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "OP-USDT" + "name": "mexc_ws", + "off_chain_ticker": "OPUSDT" + }, + { + "name": "gate_ws", + "off_chain_ticker": "OP_USDT" }, { "name": "kucoin_ws", @@ -8048,17 +2023,21 @@ "off_chain_ticker": "OPUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "OP_USDT" - }, - { - "name": "mexc_ws", - "off_chain_ticker": "OPUSDT" + "name": "okx_ws", + "off_chain_ticker": "OP-USDT" } ] }, "OSMO/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "OSMO", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "osmosis/usd" @@ -8067,18 +2046,26 @@ "name": "coinbase_api", "off_chain_ticker": "OSMO-USD" }, - { - "name": "coinbase_ws", - "off_chain_ticker": "OSMO-USD" - }, { "name": "crypto_dot_com_ws", "off_chain_ticker": "OSMO_USD" + }, + { + "name": "coinbase_ws", + "off_chain_ticker": "OSMO-USD" } ] }, "OSMO/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "OSMO", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coinbase_api", "off_chain_ticker": "OSMO-USDC" @@ -8090,13 +2077,21 @@ ] }, "OSMO/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "OSMO", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "OSMO-USDT" }, { - "name": "coinbase_api", + "name": "kucoin_ws", "off_chain_ticker": "OSMO-USDT" }, { @@ -8106,15 +2101,23 @@ ] }, "PEPE/USD": { - "providers": [ - { - "name": "kraken_ws", - "off_chain_ticker": "PEPE/USD" + "ticker": { + "currency_pair": { + "Base": "PEPE", + "Quote": "USD" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "gecko_terminal_api", "off_chain_ticker": "0x6982508145454Ce325dDbE47a25d4ec3d2311933" }, + { + "name": "kraken_ws", + "off_chain_ticker": "PEPE/USD" + }, { "name": "kraken_api", "off_chain_ticker": "PEPEUSD" @@ -8122,14 +2125,22 @@ ] }, "PEPE/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "PEPE", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", + "name": "mexc_ws", "off_chain_ticker": "PEPEUSDT" }, { - "name": "okx_ws", - "off_chain_ticker": "PEPE-USDT" + "name": "gate_ws", + "off_chain_ticker": "PEPE_USDT" }, { "name": "kucoin_ws", @@ -8140,17 +2151,25 @@ "off_chain_ticker": "PEPEUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "PEPE_USDT" + "name": "bybit_ws", + "off_chain_ticker": "PEPEUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "PEPEUSDT" + "name": "okx_ws", + "off_chain_ticker": "PEPE-USDT" } ] }, "SEI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SEI", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "SEIUSD" @@ -8166,15 +2185,27 @@ ] }, "SEI/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "SEIUSDT" + "ticker": { + "currency_pair": { + "Base": "SEI", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "huobi_ws", "off_chain_ticker": "seiusdt" }, + { + "name": "mexc_ws", + "off_chain_ticker": "SEIUSDT" + }, + { + "name": "gate_ws", + "off_chain_ticker": "SEI_USDT" + }, { "name": "kucoin_ws", "off_chain_ticker": "SEI-USDT" @@ -8184,17 +2215,21 @@ "off_chain_ticker": "SEIUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "SEI_USDT" - }, - { - "name": "mexc_ws", + "name": "bybit_ws", "off_chain_ticker": "SEIUSDT" } ] }, "SHIB/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SHIB", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "SHIB/USD" @@ -8214,19 +2249,27 @@ ] }, "SHIB/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "SHIBUSDT" + "ticker": { + "currency_pair": { + "Base": "SHIB", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "SHIB-USDT" + "name": "mexc_ws", + "off_chain_ticker": "SHIBUSDT" }, { "name": "kraken_api", "off_chain_ticker": "SHIBUSDT" }, + { + "name": "gate_ws", + "off_chain_ticker": "SHIB_USDT" + }, { "name": "kucoin_ws", "off_chain_ticker": "SHIB-USDT" @@ -8236,28 +2279,36 @@ "off_chain_ticker": "SHIBUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "SHIB_USDT" + "name": "bybit_ws", + "off_chain_ticker": "SHIBUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "SHIBUSDT" + "name": "okx_ws", + "off_chain_ticker": "SHIB-USDT" } ] }, "SOL/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SOL", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "solana/usd" }, { - "name": "kraken_ws", - "off_chain_ticker": "SOL/USD" + "name": "bitstamp_ws", + "off_chain_ticker": "solusd" }, { - "name": "okx_ws", - "off_chain_ticker": "SOL-USD" + "name": "kraken_ws", + "off_chain_ticker": "SOL/USD" }, { "name": "kraken_api", @@ -8268,31 +2319,43 @@ "off_chain_ticker": "SOL-USD" }, { - "name": "coinbase_ws", - "off_chain_ticker": "SOL-USD" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "SOLUSD-PERP" }, { "name": "bitfinex_ws", "off_chain_ticker": "SOLUSD" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "solusd" + "name": "coinbase_ws", + "off_chain_ticker": "SOL-USD" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "SOLUSD-PERP" + "name": "okx_ws", + "off_chain_ticker": "SOL-USD" } ] }, "SOL/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SOL", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", + "name": "mexc_ws", "off_chain_ticker": "SOLUSDC" }, { - "name": "okx_ws", + "name": "gate_ws", + "off_chain_ticker": "SOL_USDC" + }, + { + "name": "coinbase_api", "off_chain_ticker": "SOL-USDC" }, { @@ -8304,77 +2367,89 @@ "off_chain_ticker": "SOLUSDC" }, { - "name": "coinbase_api", - "off_chain_ticker": "SOL-USDC" + "name": "bybit_ws", + "off_chain_ticker": "SOLUSDC" }, { "name": "coinbase_ws", "off_chain_ticker": "SOL-USDC" }, { - "name": "gate_ws", - "off_chain_ticker": "SOL_USDC" - }, - { - "name": "mexc_ws", - "off_chain_ticker": "SOLUSDC" + "name": "okx_ws", + "off_chain_ticker": "SOL-USDC" } ] }, "SOL/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SOL", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "SOLUSDT" + "name": "huobi_ws", + "off_chain_ticker": "solusdt" }, { "name": "kraken_ws", "off_chain_ticker": "SOL/USDT" }, { - "name": "okx_ws", - "off_chain_ticker": "SOL-USDT" + "name": "mexc_ws", + "off_chain_ticker": "SOLUSDT" }, { "name": "kraken_api", "off_chain_ticker": "SOLUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "solusdt" + "name": "gate_ws", + "off_chain_ticker": "SOL_USDT" }, { - "name": "kucoin_ws", + "name": "coinbase_api", "off_chain_ticker": "SOL-USDT" }, { - "name": "binance_api", - "off_chain_ticker": "SOLUSDT" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "SOL_USDT" }, { - "name": "coinbase_api", + "name": "kucoin_ws", "off_chain_ticker": "SOL-USDT" }, { - "name": "coinbase_ws", - "off_chain_ticker": "SOL-USDT" + "name": "binance_api", + "off_chain_ticker": "SOLUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "SOL_USDT" + "name": "bybit_ws", + "off_chain_ticker": "SOLUSDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "SOL_USDT" + "name": "coinbase_ws", + "off_chain_ticker": "SOL-USDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "SOLUSDT" + "name": "okx_ws", + "off_chain_ticker": "SOL-USDT" } ] }, "SUI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SUI", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_api", "off_chain_ticker": "SUIUSD" @@ -8390,18 +2465,26 @@ ] }, "SUI/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "SUI", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "SUIUSDT" + "name": "huobi_ws", + "off_chain_ticker": "suiusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "SUI-USDT" + "name": "mexc_ws", + "off_chain_ticker": "SUIUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "suiusdt" + "name": "gate_ws", + "off_chain_ticker": "SUI_USDT" }, { "name": "kucoin_ws", @@ -8412,17 +2495,25 @@ "off_chain_ticker": "SUIUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "SUI_USDT" + "name": "bybit_ws", + "off_chain_ticker": "SUIUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "SUIUSDT" + "name": "okx_ws", + "off_chain_ticker": "SUI-USDT" } ] }, "TIA/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "TIA", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coingecko_api", "off_chain_ticker": "celestia/usd" @@ -8431,30 +2522,38 @@ "name": "kraken_ws", "off_chain_ticker": "TIA/USD" }, - { - "name": "okx_ws", - "off_chain_ticker": "TIA-USD" - }, { "name": "coinbase_api", "off_chain_ticker": "TIA-USD" }, { - "name": "coinbase_ws", - "off_chain_ticker": "TIA-USD" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "TIAUSD-PERP" }, { "name": "bitfinex_ws", "off_chain_ticker": "TIAUSD" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "TIAUSD-PERP" + "name": "coinbase_ws", + "off_chain_ticker": "TIA-USD" + }, + { + "name": "okx_ws", + "off_chain_ticker": "TIA-USD" } ] }, "TIA/USDC": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "TIA", + "Quote": "USDC" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "coinbase_api", "off_chain_ticker": "TIA-USDC" @@ -8466,39 +2565,55 @@ ] }, "TIA/USDT": { - "providers": [ - { - "name": "okx_ws", - "off_chain_ticker": "TIA-USDT" + "ticker": { + "currency_pair": { + "Base": "TIA", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "huobi_ws", "off_chain_ticker": "tiausdt" }, { - "name": "kucoin_ws", - "off_chain_ticker": "TIA-USDT" + "name": "gate_ws", + "off_chain_ticker": "TIA_USDT" }, { "name": "coinbase_api", "off_chain_ticker": "TIA-USDT" }, { - "name": "coinbase_ws", + "name": "crypto_dot_com_ws", + "off_chain_ticker": "TIA_USDT" + }, + { + "name": "kucoin_ws", "off_chain_ticker": "TIA-USDT" }, { - "name": "gate_ws", - "off_chain_ticker": "TIA_USDT" + "name": "coinbase_ws", + "off_chain_ticker": "TIA-USDT" }, { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "TIA_USDT" + "name": "okx_ws", + "off_chain_ticker": "TIA-USDT" } ] }, "TRX/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "TRX", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "TRX/USD" @@ -8510,18 +2625,26 @@ ] }, "TRX/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "TRX", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "TRXUSDT" + "name": "huobi_ws", + "off_chain_ticker": "trxusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "TRX-USDT" + "name": "mexc_ws", + "off_chain_ticker": "TRXUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "trxusdt" + "name": "gate_ws", + "off_chain_ticker": "TRX_USDT" }, { "name": "kucoin_ws", @@ -8532,17 +2655,25 @@ "off_chain_ticker": "TRXUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "TRX_USDT" + "name": "bybit_ws", + "off_chain_ticker": "TRXUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "TRXUSDT" + "name": "okx_ws", + "off_chain_ticker": "TRX-USDT" } ] }, "UNI/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "UNI", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "UNI/USD" @@ -8562,14 +2693,18 @@ ] }, "UNI/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "UNIUSDT" + "ticker": { + "currency_pair": { + "Base": "UNI", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "UNI-USDT" + "name": "gate_ws", + "off_chain_ticker": "UNI_USDT" }, { "name": "kucoin_ws", @@ -8580,48 +2715,76 @@ "off_chain_ticker": "UNIUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "UNI_USDT" + "name": "bybit_ws", + "off_chain_ticker": "UNIUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "UNI-USDT" } ] }, "USDC/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "USDC", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "USDC/USD" }, { - "name": "okx_ws", + "name": "coinbase_api", "off_chain_ticker": "USDC-USD" }, { - "name": "coinbase_api", + "name": "okx_ws", "off_chain_ticker": "USDC-USD" } ] }, "USDC/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "USDC", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "USDCUSDT" + "name": "bitstamp_ws", + "off_chain_ticker": "usdcusdt" + }, + { + "name": "huobi_ws", + "off_chain_ticker": "usdcusdt" }, { "name": "kraken_ws", "off_chain_ticker": "USDC/USDT" }, { - "name": "okx_ws", - "off_chain_ticker": "USDC-USDT" + "name": "mexc_ws", + "off_chain_ticker": "USDCUSDT" }, { "name": "kraken_api", "off_chain_ticker": "USDCUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "usdcusdt" + "name": "gate_ws", + "off_chain_ticker": "USDC_USDT" + }, + { + "name": "coinbase_api", + "off_chain_ticker": "USDC-USDT" }, { "name": "kucoin_ws", @@ -8632,76 +2795,84 @@ "off_chain_ticker": "USDCUSDT" }, { - "name": "coinbase_api", - "off_chain_ticker": "USDC-USDT" + "name": "bybit_ws", + "off_chain_ticker": "USDCUSDT" }, { "name": "coinbase_ws", "off_chain_ticker": "USDC-USDT" }, { - "name": "gate_ws", - "off_chain_ticker": "USDC_USDT" - }, - { - "name": "bitstamp_ws", - "off_chain_ticker": "usdcusdt" - }, - { - "name": "mexc_ws", - "off_chain_ticker": "USDCUSDT" + "name": "okx_ws", + "off_chain_ticker": "USDC-USDT" } ] }, "USDT/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "USDT", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ + { + "name": "bitstamp_ws", + "off_chain_ticker": "usdtusd" + }, { "name": "kraken_ws", "off_chain_ticker": "USDT/USD" }, { - "name": "okx_ws", + "name": "kraken_api", + "off_chain_ticker": "USDTZUSD" + }, + { + "name": "coinbase_api", "off_chain_ticker": "USDT-USD" }, { - "name": "kraken_api", - "off_chain_ticker": "USDTZUSD" + "name": "crypto_dot_com_ws", + "off_chain_ticker": "USDT_USD" }, { "name": "binance_api", "off_chain_ticker": "USDTUSD" }, - { - "name": "coinbase_api", - "off_chain_ticker": "USDT-USD" - }, { "name": "coinbase_ws", "off_chain_ticker": "USDT-USD" }, { - "name": "bitstamp_ws", - "off_chain_ticker": "usdtusd" - }, - { - "name": "crypto_dot_com_ws", - "off_chain_ticker": "USDT_USD" + "name": "okx_ws", + "off_chain_ticker": "USDT-USD" } ] }, "WLD/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "WLD", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "WLDUSDT" + "name": "huobi_ws", + "off_chain_ticker": "wldusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "WLD-USDT" + "name": "mexc_ws", + "off_chain_ticker": "WLDUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "wldusdt" + "name": "gate_ws", + "off_chain_ticker": "WLD_USDT" }, { "name": "kucoin_ws", @@ -8712,17 +2883,25 @@ "off_chain_ticker": "WLDUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "WLD_USDT" + "name": "bybit_ws", + "off_chain_ticker": "WLDUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "WLDUSDT" + "name": "okx_ws", + "off_chain_ticker": "WLD-USDT" } ] }, "XLM/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "XLM", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "XXLMZ/USD" @@ -8742,14 +2921,18 @@ ] }, "XLM/USDT": { - "providers": [ - { - "name": "bybit_ws", - "off_chain_ticker": "XLMUSDT" + "ticker": { + "currency_pair": { + "Base": "XLM", + "Quote": "USDT" }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "okx_ws", - "off_chain_ticker": "XLM-USDT" + "name": "mexc_ws", + "off_chain_ticker": "XLMUSDT" }, { "name": "kucoin_ws", @@ -8760,13 +2943,25 @@ "off_chain_ticker": "XLMUSDT" }, { - "name": "mexc_ws", + "name": "bybit_ws", "off_chain_ticker": "XLMUSDT" + }, + { + "name": "okx_ws", + "off_chain_ticker": "XLM-USDT" } ] }, "XRP/USD": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "XRP", + "Quote": "USD" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { "name": "kraken_ws", "off_chain_ticker": "XXRPZ/USD" @@ -8786,22 +2981,30 @@ ] }, "XRP/USDT": { - "providers": [ + "ticker": { + "currency_pair": { + "Base": "XRP", + "Quote": "USDT" + }, + "decimals": 18, + "min_provider_count": 1 + }, + "provider_configs": [ { - "name": "bybit_ws", - "off_chain_ticker": "XRPUSDT" + "name": "huobi_ws", + "off_chain_ticker": "xrpusdt" }, { - "name": "okx_ws", - "off_chain_ticker": "XRP-USDT" + "name": "mexc_ws", + "off_chain_ticker": "XRPUSDT" }, { "name": "kraken_api", "off_chain_ticker": "XRPUSDT" }, { - "name": "huobi_ws", - "off_chain_ticker": "xrpusdt" + "name": "gate_ws", + "off_chain_ticker": "XRP_USDT" }, { "name": "kucoin_ws", @@ -8812,12 +3015,12 @@ "off_chain_ticker": "XRPUSDT" }, { - "name": "gate_ws", - "off_chain_ticker": "XRP_USDT" + "name": "bybit_ws", + "off_chain_ticker": "XRPUSDT" }, { - "name": "mexc_ws", - "off_chain_ticker": "XRPUSDT" + "name": "okx_ws", + "off_chain_ticker": "XRP-USDT" } ] } diff --git a/config/local/oracle.json b/config/local/oracle.json index f5dbeb2ef..f4d49b154 100644 --- a/config/local/oracle.json +++ b/config/local/oracle.json @@ -1,5 +1,5 @@ { - "updateInterval": 500000000, + "updateInterval": 250000000, "maxPriceAge": 120000000000, "providers": [ { @@ -97,7 +97,7 @@ "api": { "enabled": true, "timeout": 500000000, - "interval": 5000000000, + "interval": 20000000000, "reconnectTimeout": 2000000000, "maxQueries": 1, "atomic": false, diff --git a/oracle/constants/currency_pairs.go b/oracle/constants/currency_pairs.go new file mode 100644 index 000000000..d4abfe671 --- /dev/null +++ b/oracle/constants/currency_pairs.go @@ -0,0 +1,132 @@ +package constants + +import ( + pkgtypes "github.com/skip-mev/slinky/pkg/types" +) + +var ( + // The following are the default currency pairs for the oracle sidecar. + // + // USD denominated tickers. + APE_USD = pkgtypes.NewCurrencyPair("APE", "USD") + APTOS_USD = pkgtypes.NewCurrencyPair("APT", "USD") + ARBITRUM_USD = pkgtypes.NewCurrencyPair("ARB", "USD") + ATOM_USD = pkgtypes.NewCurrencyPair("ATOM", "USD") + AVAX_USD = pkgtypes.NewCurrencyPair("AVAX", "USD") + BCH_USD = pkgtypes.NewCurrencyPair("BCH", "USD") + BITCOIN_USD = pkgtypes.NewCurrencyPair("BTC", "USD") + BLUR_USD = pkgtypes.NewCurrencyPair("BLUR", "USD") + CARDANO_USD = pkgtypes.NewCurrencyPair("ADA", "USD") + CELESTIA_USD = pkgtypes.NewCurrencyPair("TIA", "USD") + CHAINLINK_USD = pkgtypes.NewCurrencyPair("LINK", "USD") + COMPOUND_USD = pkgtypes.NewCurrencyPair("COMP", "USD") + CURVE_USD = pkgtypes.NewCurrencyPair("CRV", "USD") + DOGE_USD = pkgtypes.NewCurrencyPair("DOGE", "USD") + DYDX_USD = pkgtypes.NewCurrencyPair("DYDX", "USD") + ETC_USD = pkgtypes.NewCurrencyPair("ETC", "USD") + ETHEREUM_USD = pkgtypes.NewCurrencyPair("ETH", "USD") + FILECOIN_USD = pkgtypes.NewCurrencyPair("FIL", "USD") + LIDO_USD = pkgtypes.NewCurrencyPair("LDO", "USD") + LITECOIN_USD = pkgtypes.NewCurrencyPair("LTC", "USD") + MAKER_USD = pkgtypes.NewCurrencyPair("MKR", "USD") + MOG_USD = pkgtypes.NewCurrencyPair("MOG", "USD") + NEAR_USD = pkgtypes.NewCurrencyPair("NEAR", "USD") + OPTIMISM_USD = pkgtypes.NewCurrencyPair("OP", "USD") + OSMOSIS_USD = pkgtypes.NewCurrencyPair("OSMO", "USD") + PEPE_USD = pkgtypes.NewCurrencyPair("PEPE", "USD") + POLKADOT_USD = pkgtypes.NewCurrencyPair("DOT", "USD") + POLYGON_USD = pkgtypes.NewCurrencyPair("MATIC", "USD") + RIPPLE_USD = pkgtypes.NewCurrencyPair("XRP", "USD") + SEI_USD = pkgtypes.NewCurrencyPair("SEI", "USD") + SHIBA_USD = pkgtypes.NewCurrencyPair("SHIB", "USD") + SOLANA_USD = pkgtypes.NewCurrencyPair("SOL", "USD") + STELLAR_USD = pkgtypes.NewCurrencyPair("XLM", "USD") + SUI_USD = pkgtypes.NewCurrencyPair("SUI", "USD") + TRON_USD = pkgtypes.NewCurrencyPair("TRX", "USD") + UNISWAP_USD = pkgtypes.NewCurrencyPair("UNI", "USD") + USDC_USD = pkgtypes.NewCurrencyPair("USDC", "USD") + USDT_USD = pkgtypes.NewCurrencyPair("USDT", "USD") + WORLD_USD = pkgtypes.NewCurrencyPair("WLD", "USD") + + // USDC denominated tickers. + APE_USDC = pkgtypes.NewCurrencyPair("APE", "USDC") + APTOS_USDC = pkgtypes.NewCurrencyPair("APT", "USDC") + ARBITRUM_USDC = pkgtypes.NewCurrencyPair("ARB", "USDC") + ATOM_USDC = pkgtypes.NewCurrencyPair("ATOM", "USDC") + AVAX_USDC = pkgtypes.NewCurrencyPair("AVAX", "USDC") + BCH_USDC = pkgtypes.NewCurrencyPair("BCH", "USDC") + BITCOIN_USDC = pkgtypes.NewCurrencyPair("BTC", "USDC") + BLUR_USDC = pkgtypes.NewCurrencyPair("BLUR", "USDC") + CARDANO_USDC = pkgtypes.NewCurrencyPair("ADA", "USDC") + CELESTIA_USDC = pkgtypes.NewCurrencyPair("TIA", "USDC") + CHAINLINK_USDC = pkgtypes.NewCurrencyPair("LINK", "USDC") + COMPOUND_USDC = pkgtypes.NewCurrencyPair("COMP", "USDC") + CURVE_USDC = pkgtypes.NewCurrencyPair("CRV", "USDC") + DOGE_USDC = pkgtypes.NewCurrencyPair("DOGE", "USDC") + DYDX_USDC = pkgtypes.NewCurrencyPair("DYDX", "USDC") + ETC_USDC = pkgtypes.NewCurrencyPair("ETC", "USDC") + ETHEREUM_USDC = pkgtypes.NewCurrencyPair("ETH", "USDC") + FILECOIN_USDC = pkgtypes.NewCurrencyPair("FIL", "USDC") + LIDO_USDC = pkgtypes.NewCurrencyPair("LDO", "USDC") + LITECOIN_USDC = pkgtypes.NewCurrencyPair("LTC", "USDC") + MAKER_USDC = pkgtypes.NewCurrencyPair("MKR", "USDC") + MOG_USDC = pkgtypes.NewCurrencyPair("MOG", "USDC") + NEAR_USDC = pkgtypes.NewCurrencyPair("NEAR", "USDC") + OPTIMISM_USDC = pkgtypes.NewCurrencyPair("OP", "USDC") + OSMOSIS_USDC = pkgtypes.NewCurrencyPair("OSMO", "USDC") + PEPE_USDC = pkgtypes.NewCurrencyPair("PEPE", "USDC") + POLKADOT_USDC = pkgtypes.NewCurrencyPair("DOT", "USDC") + POLYGON_USDC = pkgtypes.NewCurrencyPair("MATIC", "USDC") + RIPPLE_USDC = pkgtypes.NewCurrencyPair("XRP", "USDC") + SEI_USDC = pkgtypes.NewCurrencyPair("SEI", "USDC") + SHIBA_USDC = pkgtypes.NewCurrencyPair("SHIB", "USDC") + SOLANA_USDC = pkgtypes.NewCurrencyPair("SOL", "USDC") + STELLAR_USDC = pkgtypes.NewCurrencyPair("XLM", "USDC") + SUI_USDC = pkgtypes.NewCurrencyPair("SUI", "USDC") + TRON_USDC = pkgtypes.NewCurrencyPair("TRX", "USDC") + UNISWAP_USDC = pkgtypes.NewCurrencyPair("UNI", "USDC") + WORLD_USDC = pkgtypes.NewCurrencyPair("WLD", "USDC") + + // USDT denominated tickers. + APE_USDT = pkgtypes.NewCurrencyPair("APE", "USDT") + APTOS_USDT = pkgtypes.NewCurrencyPair("APT", "USDT") + ARBITRUM_USDT = pkgtypes.NewCurrencyPair("ARB", "USDT") + ATOM_USDT = pkgtypes.NewCurrencyPair("ATOM", "USDT") + AVAX_USDT = pkgtypes.NewCurrencyPair("AVAX", "USDT") + BCH_USDT = pkgtypes.NewCurrencyPair("BCH", "USDT") + BITCOIN_USDT = pkgtypes.NewCurrencyPair("BTC", "USDT") + BLUR_USDT = pkgtypes.NewCurrencyPair("BLUR", "USDT") + CARDANO_USDT = pkgtypes.NewCurrencyPair("ADA", "USDT") + CELESTIA_USDT = pkgtypes.NewCurrencyPair("TIA", "USDT") + CHAINLINK_USDT = pkgtypes.NewCurrencyPair("LINK", "USDT") + COMPOUND_USDT = pkgtypes.NewCurrencyPair("COMP", "USDT") + CURVE_USDT = pkgtypes.NewCurrencyPair("CRV", "USDT") + DOGE_USDT = pkgtypes.NewCurrencyPair("DOGE", "USDT") + DYDX_USDT = pkgtypes.NewCurrencyPair("DYDX", "USDT") + ETC_USDT = pkgtypes.NewCurrencyPair("ETC", "USDT") + ETHEREUM_USDT = pkgtypes.NewCurrencyPair("ETH", "USDT") + FILECOIN_USDT = pkgtypes.NewCurrencyPair("FIL", "USDT") + LIDO_USDT = pkgtypes.NewCurrencyPair("LDO", "USDT") + LITECOIN_USDT = pkgtypes.NewCurrencyPair("LTC", "USDT") + MAKER_USDT = pkgtypes.NewCurrencyPair("MKR", "USDT") + MOG_USDT = pkgtypes.NewCurrencyPair("MOG", "USDT") + NEAR_USDT = pkgtypes.NewCurrencyPair("NEAR", "USDT") + OPTIMISM_USDT = pkgtypes.NewCurrencyPair("OP", "USDT") + OSMOSIS_USDT = pkgtypes.NewCurrencyPair("OSMO", "USDT") + PEPE_USDT = pkgtypes.NewCurrencyPair("PEPE", "USDT") + POLKADOT_USDT = pkgtypes.NewCurrencyPair("DOT", "USDT") + POLYGON_USDT = pkgtypes.NewCurrencyPair("MATIC", "USDT") + RIPPLE_USDT = pkgtypes.NewCurrencyPair("XRP", "USDT") + SEI_USDT = pkgtypes.NewCurrencyPair("SEI", "USDT") + SHIBA_USDT = pkgtypes.NewCurrencyPair("SHIB", "USDT") + SOLANA_USDT = pkgtypes.NewCurrencyPair("SOL", "USDT") + STELLAR_USDT = pkgtypes.NewCurrencyPair("XLM", "USDT") + SUI_USDT = pkgtypes.NewCurrencyPair("SUI", "USDT") + TRON_USDT = pkgtypes.NewCurrencyPair("TRX", "USDT") + UNISWAP_USDT = pkgtypes.NewCurrencyPair("UNI", "USDT") + USDC_USDT = pkgtypes.NewCurrencyPair("USDC", "USDT") + WORLD_USDT = pkgtypes.NewCurrencyPair("WLD", "USDT") + + // BTC denominated tickers. + ETHEREUM_BITCOIN = pkgtypes.NewCurrencyPair("ETH", "BTC") +) diff --git a/oracle/constants/tickers.go b/oracle/constants/tickers.go deleted file mode 100644 index 5199169a4..000000000 --- a/oracle/constants/tickers.go +++ /dev/null @@ -1,132 +0,0 @@ -package constants - -import ( - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" -) - -var ( - // The following are the default tickers for the oracle sidecar. - // - // USD denominated tickers. - APE_USD = mmtypes.NewTicker("APE", "USD", 8, 1) - APTOS_USD = mmtypes.NewTicker("APT", "USD", 8, 1) - ARBITRUM_USD = mmtypes.NewTicker("ARB", "USD", 8, 1) - ATOM_USD = mmtypes.NewTicker("ATOM", "USD", 8, 1) - AVAX_USD = mmtypes.NewTicker("AVAX", "USD", 8, 1) - BCH_USD = mmtypes.NewTicker("BCH", "USD", 8, 1) - BITCOIN_USD = mmtypes.NewTicker("BTC", "USD", 8, 1) - BLUR_USD = mmtypes.NewTicker("BLUR", "USD", 8, 1) - CARDANO_USD = mmtypes.NewTicker("ADA", "USD", 8, 1) - CELESTIA_USD = mmtypes.NewTicker("TIA", "USD", 8, 1) - CHAINLINK_USD = mmtypes.NewTicker("LINK", "USD", 8, 1) - COMPOUND_USD = mmtypes.NewTicker("COMP", "USD", 8, 1) - CURVE_USD = mmtypes.NewTicker("CRV", "USD", 8, 1) - DOGE_USD = mmtypes.NewTicker("DOGE", "USD", 18, 1) - DYDX_USD = mmtypes.NewTicker("DYDX", "USD", 8, 1) - ETC_USD = mmtypes.NewTicker("ETC", "USD", 8, 1) - ETHEREUM_USD = mmtypes.NewTicker("ETH", "USD", 8, 1) - FILECOIN_USD = mmtypes.NewTicker("FIL", "USD", 8, 1) - LIDO_USD = mmtypes.NewTicker("LDO", "USD", 8, 1) - LITECOIN_USD = mmtypes.NewTicker("LTC", "USD", 8, 1) - MAKER_USD = mmtypes.NewTicker("MKR", "USD", 8, 1) - MOG_USD = mmtypes.NewTicker("MOG", "USD", 18, 1) - NEAR_USD = mmtypes.NewTicker("NEAR", "USD", 8, 1) - OPTIMISM_USD = mmtypes.NewTicker("OP", "USD", 8, 1) - OSMOSIS_USD = mmtypes.NewTicker("OSMO", "USD", 8, 1) - PEPE_USD = mmtypes.NewTicker("PEPE", "USD", 18, 1) - POLKADOT_USD = mmtypes.NewTicker("DOT", "USD", 8, 1) - POLYGON_USD = mmtypes.NewTicker("MATIC", "USD", 8, 1) - RIPPLE_USD = mmtypes.NewTicker("XRP", "USD", 8, 1) - SEI_USD = mmtypes.NewTicker("SEI", "USD", 8, 1) - SHIBA_USD = mmtypes.NewTicker("SHIB", "USD", 18, 1) - SOLANA_USD = mmtypes.NewTicker("SOL", "USD", 8, 1) - STELLAR_USD = mmtypes.NewTicker("XLM", "USD", 8, 1) - SUI_USD = mmtypes.NewTicker("SUI", "USD", 8, 1) - TRON_USD = mmtypes.NewTicker("TRX", "USD", 8, 1) - UNISWAP_USD = mmtypes.NewTicker("UNI", "USD", 8, 1) - USDC_USD = mmtypes.NewTicker("USDC", "USD", 8, 1) - USDT_USD = mmtypes.NewTicker("USDT", "USD", 8, 1) - WORLD_USD = mmtypes.NewTicker("WLD", "USD", 8, 1) - - // USDC denominated tickers. - APE_USDC = mmtypes.NewTicker("APE", "USDC", 8, 1) - APTOS_USDC = mmtypes.NewTicker("APT", "USDC", 8, 1) - ARBITRUM_USDC = mmtypes.NewTicker("ARB", "USDC", 8, 1) - ATOM_USDC = mmtypes.NewTicker("ATOM", "USDC", 8, 1) - AVAX_USDC = mmtypes.NewTicker("AVAX", "USDC", 8, 1) - BCH_USDC = mmtypes.NewTicker("BCH", "USDC", 8, 1) - BITCOIN_USDC = mmtypes.NewTicker("BTC", "USDC", 8, 1) - BLUR_USDC = mmtypes.NewTicker("BLUR", "USDC", 8, 1) - CARDANO_USDC = mmtypes.NewTicker("ADA", "USDC", 8, 1) - CELESTIA_USDC = mmtypes.NewTicker("TIA", "USDC", 8, 1) - CHAINLINK_USDC = mmtypes.NewTicker("LINK", "USDC", 8, 1) - COMPOUND_USDC = mmtypes.NewTicker("COMP", "USDC", 8, 1) - CURVE_USDC = mmtypes.NewTicker("CRV", "USDC", 8, 1) - DOGE_USDC = mmtypes.NewTicker("DOGE", "USDC", 18, 1) - DYDX_USDC = mmtypes.NewTicker("DYDX", "USDC", 8, 1) - ETC_USDC = mmtypes.NewTicker("ETC", "USDC", 8, 1) - ETHEREUM_USDC = mmtypes.NewTicker("ETH", "USDC", 8, 1) - FILECOIN_USDC = mmtypes.NewTicker("FIL", "USDC", 8, 1) - LIDO_USDC = mmtypes.NewTicker("LDO", "USDC", 8, 1) - LITECOIN_USDC = mmtypes.NewTicker("LTC", "USDC", 8, 1) - MAKER_USDC = mmtypes.NewTicker("MKR", "USDC", 8, 1) - MOG_USDC = mmtypes.NewTicker("MOG", "USDC", 18, 1) - NEAR_USDC = mmtypes.NewTicker("NEAR", "USDC", 8, 1) - OPTIMISM_USDC = mmtypes.NewTicker("OP", "USDC", 8, 1) - OSMOSIS_USDC = mmtypes.NewTicker("OSMO", "USDC", 8, 1) - PEPE_USDC = mmtypes.NewTicker("PEPE", "USDC", 18, 1) - POLKADOT_USDC = mmtypes.NewTicker("DOT", "USDC", 8, 1) - POLYGON_USDC = mmtypes.NewTicker("MATIC", "USDC", 8, 1) - RIPPLE_USDC = mmtypes.NewTicker("XRP", "USDC", 8, 1) - SEI_USDC = mmtypes.NewTicker("SEI", "USDC", 8, 1) - SHIBA_USDC = mmtypes.NewTicker("SHIB", "USDC", 18, 1) - SOLANA_USDC = mmtypes.NewTicker("SOL", "USDC", 8, 1) - STELLAR_USDC = mmtypes.NewTicker("XLM", "USDC", 8, 1) - SUI_USDC = mmtypes.NewTicker("SUI", "USDC", 8, 1) - TRON_USDC = mmtypes.NewTicker("TRX", "USDC", 8, 1) - UNISWAP_USDC = mmtypes.NewTicker("UNI", "USDC", 8, 1) - WORLD_USDC = mmtypes.NewTicker("WLD", "USDC", 8, 1) - - // USDT denominated tickers. - APE_USDT = mmtypes.NewTicker("APE", "USDT", 8, 1) - APTOS_USDT = mmtypes.NewTicker("APT", "USDT", 8, 1) - ARBITRUM_USDT = mmtypes.NewTicker("ARB", "USDT", 8, 1) - ATOM_USDT = mmtypes.NewTicker("ATOM", "USDT", 8, 1) - AVAX_USDT = mmtypes.NewTicker("AVAX", "USDT", 8, 1) - BCH_USDT = mmtypes.NewTicker("BCH", "USDT", 8, 1) - BITCOIN_USDT = mmtypes.NewTicker("BTC", "USDT", 8, 1) - BLUR_USDT = mmtypes.NewTicker("BLUR", "USDT", 8, 1) - CARDANO_USDT = mmtypes.NewTicker("ADA", "USDT", 8, 1) - CELESTIA_USDT = mmtypes.NewTicker("TIA", "USDT", 8, 1) - CHAINLINK_USDT = mmtypes.NewTicker("LINK", "USDT", 8, 1) - COMPOUND_USDT = mmtypes.NewTicker("COMP", "USDT", 8, 1) - CURVE_USDT = mmtypes.NewTicker("CRV", "USDT", 8, 1) - DOGE_USDT = mmtypes.NewTicker("DOGE", "USDT", 18, 1) - DYDX_USDT = mmtypes.NewTicker("DYDX", "USDT", 8, 1) - ETC_USDT = mmtypes.NewTicker("ETC", "USDT", 8, 1) - ETHEREUM_USDT = mmtypes.NewTicker("ETH", "USDT", 8, 1) - FILECOIN_USDT = mmtypes.NewTicker("FIL", "USDT", 8, 1) - LIDO_USDT = mmtypes.NewTicker("LDO", "USDT", 8, 1) - LITECOIN_USDT = mmtypes.NewTicker("LTC", "USDT", 8, 1) - MAKER_USDT = mmtypes.NewTicker("MKR", "USDT", 8, 1) - MOG_USDT = mmtypes.NewTicker("MOG", "USDT", 18, 1) - NEAR_USDT = mmtypes.NewTicker("NEAR", "USDT", 8, 1) - OPTIMISM_USDT = mmtypes.NewTicker("OP", "USDT", 8, 1) - OSMOSIS_USDT = mmtypes.NewTicker("OSMO", "USDT", 8, 1) - PEPE_USDT = mmtypes.NewTicker("PEPE", "USDT", 18, 1) - POLKADOT_USDT = mmtypes.NewTicker("DOT", "USDT", 8, 1) - POLYGON_USDT = mmtypes.NewTicker("MATIC", "USDT", 8, 1) - RIPPLE_USDT = mmtypes.NewTicker("XRP", "USDT", 8, 1) - SEI_USDT = mmtypes.NewTicker("SEI", "USDT", 8, 1) - SHIBA_USDT = mmtypes.NewTicker("SHIB", "USDT", 18, 1) - SOLANA_USDT = mmtypes.NewTicker("SOL", "USDT", 8, 1) - STELLAR_USDT = mmtypes.NewTicker("XLM", "USDT", 8, 1) - SUI_USDT = mmtypes.NewTicker("SUI", "USDT", 8, 1) - TRON_USDT = mmtypes.NewTicker("TRX", "USDT", 8, 1) - UNISWAP_USDT = mmtypes.NewTicker("UNI", "USDT", 8, 1) - USDC_USDT = mmtypes.NewTicker("USDC", "USDT", 8, 1) - WORLD_USDT = mmtypes.NewTicker("WLD", "USDT", 8, 1) - - // BTC denominated tickers. - ETHEREUM_BITCOIN = mmtypes.NewTicker("ETH", "BTC", 8, 1) -) diff --git a/oracle/metrics_test.go b/oracle/metrics_test.go index 70cf33bf1..818110484 100644 --- a/oracle/metrics_test.go +++ b/oracle/metrics_test.go @@ -11,17 +11,17 @@ import ( "github.com/skip-mev/slinky/oracle" metricmocks "github.com/skip-mev/slinky/oracle/metrics/mocks" "github.com/skip-mev/slinky/oracle/types" + "github.com/skip-mev/slinky/pkg/math/median" providertypes "github.com/skip-mev/slinky/providers/types" providermocks "github.com/skip-mev/slinky/providers/types/mocks" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) type OracleMetricsTestSuite struct { suite.Suite // mocked providers - mockProvider1 *providermocks.Provider[mmtypes.Ticker, *big.Int] - mockProvider2 *providermocks.Provider[mmtypes.Ticker, *big.Int] + mockProvider1 *providermocks.Provider[types.ProviderTicker, *big.Float] + mockProvider2 *providermocks.Provider[types.ProviderTicker, *big.Float] // mock metrics mockMetrics *metricmocks.Metrics @@ -41,10 +41,10 @@ func TestOracleMetricsTestSuite(t *testing.T) { func (s *OracleMetricsTestSuite) SetupTest() { // mock providers - s.mockProvider1 = providermocks.NewProvider[mmtypes.Ticker, *big.Int](s.T()) + s.mockProvider1 = providermocks.NewProvider[types.ProviderTicker, *big.Float](s.T()) s.mockProvider1.On("Name").Return("provider1").Maybe() - s.mockProvider2 = providermocks.NewProvider[mmtypes.Ticker, *big.Int](s.T()) + s.mockProvider2 = providermocks.NewProvider[types.ProviderTicker, *big.Float](s.T()) s.mockProvider2.On("Name").Return("provider2").Maybe() // mock metrics @@ -60,6 +60,7 @@ func (s *OracleMetricsTestSuite) SetupTest() { }, ), oracle.WithMetrics(s.mockMetrics), + oracle.WithAggregateFunction(median.ComputeMedian()), ) s.Require().NoError(err) } diff --git a/oracle/mocks/mock_oracle.go b/oracle/mocks/mock_oracle.go index 918a00ef7..2e5b3f90a 100644 --- a/oracle/mocks/mock_oracle.go +++ b/oracle/mocks/mock_oracle.go @@ -9,8 +9,6 @@ import ( mock "github.com/stretchr/testify/mock" time "time" - - types "github.com/skip-mev/slinky/x/marketmap/types" ) // Oracle is an autogenerated mock type for the Oracle type @@ -37,19 +35,19 @@ func (_m *Oracle) GetLastSyncTime() time.Time { } // GetPrices provides a mock function with given fields: -func (_m *Oracle) GetPrices() map[types.Ticker]*big.Int { +func (_m *Oracle) GetPrices() map[string]*big.Float { ret := _m.Called() if len(ret) == 0 { panic("no return value specified for GetPrices") } - var r0 map[types.Ticker]*big.Int - if rf, ok := ret.Get(0).(func() map[types.Ticker]*big.Int); ok { + var r0 map[string]*big.Float + if rf, ok := ret.Get(0).(func() map[string]*big.Float); ok { r0 = rf() } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(map[types.Ticker]*big.Int) + r0 = ret.Get(0).(map[string]*big.Float) } } diff --git a/oracle/oracle.go b/oracle/oracle.go index 94de27733..15c0753ff 100644 --- a/oracle/oracle.go +++ b/oracle/oracle.go @@ -9,10 +9,8 @@ import ( "go.uber.org/zap" - "github.com/skip-mev/slinky/aggregator" oraclemetrics "github.com/skip-mev/slinky/oracle/metrics" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math/median" ssync "github.com/skip-mev/slinky/pkg/sync" ) @@ -24,7 +22,7 @@ var _ Oracle = (*OracleImpl)(nil) type Oracle interface { IsRunning() bool GetLastSyncTime() time.Time - GetPrices() types.TickerPrices + GetPrices() types.AggregatorPrices Start(ctx context.Context) error Stop() } @@ -76,12 +74,9 @@ type OracleImpl struct { //nolint // price across all providers. func New(opts ...Option) (*OracleImpl, error) { o := &OracleImpl{ - closer: ssync.NewCloser(), - logger: zap.NewNop(), - metrics: oraclemetrics.NewNopMetrics(), - priceAggregator: types.NewPriceAggregator( - aggregator.WithAggregateFn(median.ComputeMedian()), - ), + closer: ssync.NewCloser(), + logger: zap.NewNop(), + metrics: oraclemetrics.NewNopMetrics(), updateInterval: 1 * time.Second, maxCacheAge: time.Minute, // default max cache age is 1 minute } @@ -204,7 +199,7 @@ func (o *OracleImpl) fetchPrices(provider types.PriceProviderI) { return } - timeFilteredPrices := make(types.TickerPrices) + timeFilteredPrices := make(types.AggregatorPrices) for pair, result := range prices { // If the price is older than the maxCacheAge, skip it. diff := time.Now().UTC().Sub(result.Timestamp) @@ -227,7 +222,7 @@ func (o *OracleImpl) fetchPrices(provider types.PriceProviderI) { zap.String("price", result.Value.String()), zap.Duration("diff", diff), ) - timeFilteredPrices[pair] = result.Value + timeFilteredPrices[pair.GetOffChainTicker()] = result.Value } o.logger.Info("provider returned prices", @@ -255,7 +250,7 @@ func (o *OracleImpl) setLastSyncTime(t time.Time) { } // GetPrices returns the aggregate prices from the oracle. -func (o *OracleImpl) GetPrices() types.TickerPrices { +func (o *OracleImpl) GetPrices() types.AggregatorPrices { prices := o.priceAggregator.GetAggregatedData() return prices } diff --git a/oracle/oracle_test.go b/oracle/oracle_test.go index 0d0d72a80..d48a1df47 100644 --- a/oracle/oracle_test.go +++ b/oracle/oracle_test.go @@ -1,8 +1,6 @@ package oracle_test import ( - "context" - "math/big" "math/rand" "testing" "time" @@ -10,12 +8,8 @@ import ( "github.com/stretchr/testify/suite" "go.uber.org/zap" - "github.com/skip-mev/slinky/oracle" "github.com/skip-mev/slinky/oracle/config" - "github.com/skip-mev/slinky/oracle/constants" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/providers/base/testutils" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( @@ -60,7 +54,7 @@ type OracleTestSuite struct { logger *zap.Logger // Oracle config - currencyPairs []mmtypes.Ticker + currencyPairs []types.ProviderTicker } func TestOracleSuite(t *testing.T) { @@ -71,298 +65,9 @@ func (s *OracleTestSuite) SetupTest() { s.random = rand.New(rand.NewSource(time.Now().UnixNano())) s.logger = zap.NewExample() - s.currencyPairs = []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, - constants.ATOM_USD, - } -} - -func (s *OracleTestSuite) TestStopWithContextCancel() { - testCases := []struct { - name string - factory types.PriceProviderFactoryI - }{ - { - name: "no providers", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - return nil, nil - }, - }, - { - name: "1 provider", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - s.logger, - providerCfg1, - s.currencyPairs, - nil, - 200*time.Millisecond, - ) - - // Create the provider factory. - providers := []types.PriceProviderI{provider} - return providers, nil - }, - }, - { - name: "multiple providers", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - provider1 := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - s.logger, - providerCfg1, - s.currencyPairs, - nil, - 200*time.Millisecond, - ) - - provider2 := testutils.CreateWebSocketProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - time.Second, - s.currencyPairs, - providerCfg2, - s.logger, - nil, - ) - - // Create the provider factory. - providers := []types.PriceProviderI{provider1, provider2} - return providers, nil - }, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - cfg := config.OracleConfig{ - UpdateInterval: 1 * time.Second, - } - - providers, err := tc.factory(cfg) - s.Require().NoError(err) - - oracle, err := oracle.New( - oracle.WithLogger(s.logger), - oracle.WithProviders(providers), - oracle.WithUpdateInterval(cfg.UpdateInterval), - ) - s.Require().NoError(err) - - ctx, cancel := context.WithCancel(context.Background()) - - // Start the oracle. This should automatically stop. - go func() { - err = oracle.Start(ctx) - s.Require().Equal(err, context.Canceled) - }() - - // Wait for the experiment to run. - time.Sleep(2 * time.Second) - cancel() - - // Ensure that the oracle is not running. - s.Eventually(checkFn(oracle), 3*time.Second, 100*time.Millisecond) - }) - } -} - -func (s *OracleTestSuite) TestStopWithContextDeadline() { - testCases := []struct { - name string - factory types.PriceProviderFactoryI - duration time.Duration - }{ - { - name: "no providers", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - return nil, nil - }, - duration: 1 * time.Second, - }, - { - name: "1 provider", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - s.logger, - providerCfg1, - s.currencyPairs, - nil, - 200*time.Millisecond, - ) - - // Create the provider factory. - providers := []types.PriceProviderI{provider} - return providers, nil - }, - duration: 1 * time.Second, - }, - { - name: "multiple providers", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - provider1 := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - s.logger, - providerCfg1, - s.currencyPairs, - nil, - 200*time.Millisecond, - ) - - provider2 := testutils.CreateWebSocketProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - time.Second, - s.currencyPairs, - providerCfg2, - s.logger, - nil, - ) - - // Create the provider factory. - providers := []types.PriceProviderI{provider1, provider2} - return providers, nil - }, - duration: 1 * time.Second, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - cfg := config.OracleConfig{ - UpdateInterval: 1 * time.Second, - } - - providers, err := tc.factory(cfg) - s.Require().NoError(err) - - oracle, err := oracle.New( - oracle.WithUpdateInterval(cfg.UpdateInterval), - oracle.WithLogger(s.logger), - oracle.WithProviders(providers), - ) - s.Require().NoError(err) - - ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(tc.duration)) - defer cancel() - - // Start the oracle. This should automatically stop. - go func() { - err = oracle.Start(ctx) - s.Require().Equal(err, context.DeadlineExceeded) - }() - - // Ensure that the oracle is not running. - s.Eventually(checkFn(oracle), 2*tc.duration, 100*time.Millisecond) - }) - } -} - -func (s *OracleTestSuite) TestStop() { - testCases := []struct { - name string - factory types.PriceProviderFactoryI - duration time.Duration - }{ - { - name: "1 provider", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - s.logger, - providerCfg1, - s.currencyPairs, - nil, - 200*time.Millisecond, - ) - - // Create the provider factory. - providers := []types.PriceProviderI{provider} - return providers, nil - }, - duration: 1 * time.Second, - }, - { - name: "multiple providers", - factory: func( - config.OracleConfig, - ) ([]types.PriceProviderI, error) { - provider1 := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - s.logger, - providerCfg1, - s.currencyPairs, - nil, - 200*time.Millisecond, - ) - - provider2 := testutils.CreateWebSocketProviderWithGetResponses[mmtypes.Ticker, *big.Int]( - s.T(), - time.Second, - s.currencyPairs, - providerCfg2, - s.logger, - nil, - ) - - // Create the provider factory. - providers := []types.PriceProviderI{provider1, provider2} - return providers, nil - }, - duration: 1 * time.Second, - }, - } - - for _, tc := range testCases { - s.Run(tc.name, func() { - cfg := config.OracleConfig{ - UpdateInterval: 1 * time.Second, - } - - providers, err := tc.factory(cfg) - s.Require().NoError(err) - - oracle, err := oracle.New( - oracle.WithUpdateInterval(cfg.UpdateInterval), - oracle.WithLogger(s.logger), - oracle.WithProviders(providers), - ) - s.Require().NoError(err) - - // Start the oracle. This should automatically stop. - go func() { - oracle.Start(context.Background()) - }() - - // Wait for the experiment to run. - time.Sleep(tc.duration) - - // Ensure that the oracle is not running. - oracle.Stop() - - // Ensure that the oracle is not running. - s.Eventually(checkFn(oracle), 2*tc.duration, 100*time.Millisecond) - }) - } -} - -func checkFn(o oracle.Oracle) func() bool { - return func() bool { - return !o.IsRunning() + s.currencyPairs = []types.ProviderTicker{ + types.NewProviderTicker("BTC/USD", "{}"), + types.NewProviderTicker("ETH/USD", "{}"), + types.NewProviderTicker("ATOM/USD", "{}"), } } diff --git a/oracle/orchestrator/helpers_test.go b/oracle/orchestrator/helpers_test.go index eda69ffb9..9ba708c79 100644 --- a/oracle/orchestrator/helpers_test.go +++ b/oracle/orchestrator/helpers_test.go @@ -155,21 +155,27 @@ var ( // Coinbase and OKX are supported by the marketmap. marketMap = mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - constants.ETHEREUM_USD.String(): constants.ETHEREUM_USD, - }, - Providers: map[string]mmtypes.Providers{ + Markets: map[string]mmtypes.Market{ constants.BITCOIN_USD.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.BITCOIN_USD], - okx.DefaultMarketConfig[constants.BITCOIN_USD], + Ticker: mmtypes.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + MinProviderCount: 1, + Decimals: 8, + }, + ProviderConfigs: []mmtypes.ProviderConfig{ + coinbase.DefaultMarketConfig.MustGetProviderConfig(coinbase.Name, constants.BITCOIN_USD), + okx.DefaultMarketConfig.MustGetProviderConfig(okx.Name, constants.BITCOIN_USD), }, }, constants.ETHEREUM_USD.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.ETHEREUM_USD], - okx.DefaultMarketConfig[constants.ETHEREUM_USD], + Ticker: mmtypes.Ticker{ + CurrencyPair: constants.ETHEREUM_USD, + MinProviderCount: 1, + Decimals: 8, + }, + ProviderConfigs: []mmtypes.ProviderConfig{ + coinbase.DefaultMarketConfig.MustGetProviderConfig(coinbase.Name, constants.ETHEREUM_USD), + okx.DefaultMarketConfig.MustGetProviderConfig(okx.Name, constants.ETHEREUM_USD), }, }, }, @@ -178,7 +184,7 @@ var ( func checkProviderState( t *testing.T, - expectedTickers []mmtypes.Ticker, + expectedTickers []oracletypes.ProviderTicker, expectedName string, expectedType providertypes.ProviderType, isRunning bool, @@ -193,7 +199,7 @@ func checkProviderState( ids := provider.GetIDs() require.Equal(t, len(expectedTickers), len(ids)) - seenTickers := make(map[mmtypes.Ticker]bool) + seenTickers := make(map[oracletypes.ProviderTicker]bool) for _, id := range ids { seenTickers[id] = true } @@ -214,11 +220,11 @@ func checkProviderState( func createTestMarketMapProvider( t *testing.T, ids []mmclienttypes.Chain, -) (*mocks.APIDataHandler[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse], *mmclienttypes.MarketMapProvider) { +) (*mocks.APIDataHandler[mmclienttypes.Chain, *mmtypes.MarketMapResponse], *mmclienttypes.MarketMapProvider) { t.Helper() // Create a market map api handler. - handler := mocks.NewAPIDataHandler[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse]( + handler := mocks.NewAPIDataHandler[mmclienttypes.Chain, *mmtypes.MarketMapResponse]( t, ) @@ -234,20 +240,20 @@ func createTestMarketMapProvider( var provider *mmclienttypes.MarketMapProvider if len(ids) != 0 { provider, err = mmclienttypes.NewMarketMapProvider( - base.WithName[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](mockMapperCfg.Name), - base.WithLogger[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](logger), + base.WithName[mmclienttypes.Chain, *mmtypes.MarketMapResponse](mockMapperCfg.Name), + base.WithLogger[mmclienttypes.Chain, *mmtypes.MarketMapResponse](logger), base.WithAPIQueryHandler(queryHandler), - base.WithAPIConfig[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](mockMapperCfg.API), - base.WithMetrics[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](providermetrics.NewNopProviderMetrics()), - base.WithIDs[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](ids), + base.WithAPIConfig[mmclienttypes.Chain, *mmtypes.MarketMapResponse](mockMapperCfg.API), + base.WithMetrics[mmclienttypes.Chain, *mmtypes.MarketMapResponse](providermetrics.NewNopProviderMetrics()), + base.WithIDs[mmclienttypes.Chain, *mmtypes.MarketMapResponse](ids), ) } else { provider, err = mmclienttypes.NewMarketMapProvider( - base.WithName[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](mockMapperCfg.Name), - base.WithLogger[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](logger), + base.WithName[mmclienttypes.Chain, *mmtypes.MarketMapResponse](mockMapperCfg.Name), + base.WithLogger[mmclienttypes.Chain, *mmtypes.MarketMapResponse](logger), base.WithAPIQueryHandler(queryHandler), - base.WithAPIConfig[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](mockMapperCfg.API), - base.WithMetrics[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse](providermetrics.NewNopProviderMetrics()), + base.WithAPIConfig[mmclienttypes.Chain, *mmtypes.MarketMapResponse](mockMapperCfg.API), + base.WithMetrics[mmclienttypes.Chain, *mmtypes.MarketMapResponse](providermetrics.NewNopProviderMetrics()), ) } require.NoError(t, err) @@ -258,7 +264,7 @@ func createTestMarketMapProvider( func marketMapperFactory( t *testing.T, ids []mmclienttypes.Chain, -) (*mocks.APIDataHandler[mmclienttypes.Chain, *mmtypes.GetMarketMapResponse], mmclienttypes.MarketMapFactory) { +) (*mocks.APIDataHandler[mmclienttypes.Chain, *mmtypes.MarketMapResponse], mmclienttypes.MarketMapFactory) { t.Helper() handler, provider := createTestMarketMapProvider( diff --git a/oracle/orchestrator/init.go b/oracle/orchestrator/init.go index 4dbd4b74d..ac8fafae4 100644 --- a/oracle/orchestrator/init.go +++ b/oracle/orchestrator/init.go @@ -10,7 +10,6 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base" mmclienttypes "github.com/skip-mev/slinky/service/clients/marketmap/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) // Init initializes the all of the providers that are configured via the oracle config. @@ -31,6 +30,12 @@ func (o *ProviderOrchestrator) Init() error { } if err != nil { + o.logger.Error( + "failed to initialize provider", + zap.String("provider", cfg.Name), + zap.Error(err), + ) + return fmt.Errorf("failed to initialize %s provider: %w", cfg.Name, err) } } @@ -42,7 +47,7 @@ func (o *ProviderOrchestrator) Init() error { func (o *ProviderOrchestrator) createPriceProvider(cfg config.ProviderConfig) error { // Create the provider market map. This creates the tickers the provider is configured to // support. - market, err := types.ProviderMarketMapFromMarketMap(cfg.Name, o.marketMap) + tickers, err := types.ProviderTickersFromMarketMap(cfg.Name, o.marketMap) if err != nil { return fmt.Errorf("failed to create %s's provider market map: %w", cfg.Name, err) } @@ -51,35 +56,35 @@ func (o *ProviderOrchestrator) createPriceProvider(cfg config.ProviderConfig) er var provider *types.PriceProvider switch { case cfg.API.Enabled: - queryHandler, err := o.createAPIQueryHandler(cfg, market) + queryHandler, err := o.createAPIQueryHandler(cfg) if err != nil { return fmt.Errorf("failed to create %s's api query handler: %w", cfg.Name, err) } provider, err = types.NewPriceProvider( - base.WithName[mmtypes.Ticker, *big.Int](cfg.Name), - base.WithLogger[mmtypes.Ticker, *big.Int](o.logger), + base.WithName[types.ProviderTicker, *big.Float](cfg.Name), + base.WithLogger[types.ProviderTicker, *big.Float](o.logger), base.WithAPIQueryHandler(queryHandler), - base.WithAPIConfig[mmtypes.Ticker, *big.Int](cfg.API), - base.WithIDs[mmtypes.Ticker, *big.Int](market.GetTickers()), - base.WithMetrics[mmtypes.Ticker, *big.Int](o.providerMetrics), + base.WithAPIConfig[types.ProviderTicker, *big.Float](cfg.API), + base.WithIDs[types.ProviderTicker, *big.Float](tickers), + base.WithMetrics[types.ProviderTicker, *big.Float](o.providerMetrics), ) if err != nil { return fmt.Errorf("failed to create %s's provider: %w", cfg.Name, err) } case cfg.WebSocket.Enabled: - queryHandler, err := o.createWebSocketQueryHandler(cfg, market) + queryHandler, err := o.createWebSocketQueryHandler(cfg) if err != nil { return fmt.Errorf("failed to create %s's web socket query handler: %w", cfg.Name, err) } provider, err = types.NewPriceProvider( - base.WithName[mmtypes.Ticker, *big.Int](cfg.Name), - base.WithLogger[mmtypes.Ticker, *big.Int](o.logger), + base.WithName[types.ProviderTicker, *big.Float](cfg.Name), + base.WithLogger[types.ProviderTicker, *big.Float](o.logger), base.WithWebSocketQueryHandler(queryHandler), - base.WithWebSocketConfig[mmtypes.Ticker, *big.Int](cfg.WebSocket), - base.WithIDs[mmtypes.Ticker, *big.Int](market.GetTickers()), - base.WithMetrics[mmtypes.Ticker, *big.Int](o.providerMetrics), + base.WithWebSocketConfig[types.ProviderTicker, *big.Float](cfg.WebSocket), + base.WithIDs[types.ProviderTicker, *big.Float](tickers), + base.WithMetrics[types.ProviderTicker, *big.Float](o.providerMetrics), ) if err != nil { return fmt.Errorf("failed to create %s's provider: %w", cfg.Name, err) @@ -107,25 +112,23 @@ func (o *ProviderOrchestrator) createPriceProvider(cfg config.ProviderConfig) er // createAPIQueryHandler creates a new API query handler for the given provider configuration. func (o *ProviderOrchestrator) createAPIQueryHandler( cfg config.ProviderConfig, - providerMarkets types.ProviderMarketMap, ) (types.PriceAPIQueryHandler, error) { if o.priceAPIFactory == nil { return nil, fmt.Errorf("cannot create provider; api query handler factory is not set") } - return o.priceAPIFactory(o.logger, cfg, o.apiMetrics, providerMarkets) + return o.priceAPIFactory(o.logger, cfg, o.apiMetrics) } // createWebSocketQueryHandler creates a new web socket query handler for the given provider configuration. func (o *ProviderOrchestrator) createWebSocketQueryHandler( cfg config.ProviderConfig, - providerMarkets types.ProviderMarketMap, ) (types.PriceWebSocketQueryHandler, error) { if o.priceWSFactory == nil { return nil, fmt.Errorf("cannot create provider; web socket query handler factory is not set") } - return o.priceWSFactory(o.logger, cfg, o.wsMetrics, providerMarkets) + return o.priceWSFactory(o.logger, cfg, o.wsMetrics) } // createMarketMapProvider creates a new market map provider for the given provider configuration. diff --git a/oracle/orchestrator/init_test.go b/oracle/orchestrator/init_test.go index f81e57c5b..0b153a92f 100644 --- a/oracle/orchestrator/init_test.go +++ b/oracle/orchestrator/init_test.go @@ -15,7 +15,6 @@ import ( oraclefactory "github.com/skip-mev/slinky/providers/factories/oracle" providertypes "github.com/skip-mev/slinky/providers/types" "github.com/skip-mev/slinky/providers/websockets/okx" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) func TestInit(t *testing.T) { @@ -63,20 +62,45 @@ func TestInit(t *testing.T) { state := o.GetProviderState() require.Equal(t, len(state), len(oracleCfg.Providers)) - expectedTickers := []mmtypes.Ticker{constants.BITCOIN_USD, constants.ETHEREUM_USD} - coinbaseState, ok := state[coinbase.Name] require.True(t, ok) - checkProviderState(t, expectedTickers, coinbase.Name, providertypes.API, false, coinbaseState) + checkProviderState( + t, + []oracletypes.ProviderTicker{ + coinbase.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD), + coinbase.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD), + }, + coinbase.Name, + providertypes.API, + false, + coinbaseState, + ) okxState, ok := state[okx.Name] require.True(t, ok) - checkProviderState(t, expectedTickers, okx.Name, providertypes.WebSockets, false, okxState) + checkProviderState( + t, + []oracletypes.ProviderTicker{ + okx.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD), + okx.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD), + }, + okx.Name, + providertypes.WebSockets, + false, + okxState, + ) // Ensure that the provider that is not supported by the marketmap is not enabled. binanceState, ok := state[binance.Name] require.True(t, ok) - checkProviderState(t, nil, binance.Name, providertypes.API, false, binanceState) + checkProviderState( + t, + nil, + binance.Name, + providertypes.API, + false, + binanceState, + ) }) t.Run("errors when the API query handler factory is not set", func(t *testing.T) { diff --git a/oracle/orchestrator/market_mapper_test.go b/oracle/orchestrator/market_mapper_test.go index 85aa5dde9..001dc386c 100644 --- a/oracle/orchestrator/market_mapper_test.go +++ b/oracle/orchestrator/market_mapper_test.go @@ -11,7 +11,6 @@ import ( "github.com/stretchr/testify/require" "github.com/skip-mev/slinky/oracle/orchestrator" - "github.com/skip-mev/slinky/oracle/types" oraclefactory "github.com/skip-mev/slinky/providers/factories/oracle" mmclienttypes "github.com/skip-mev/slinky/service/clients/marketmap/types" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" @@ -112,7 +111,7 @@ func TestListenForMarketMapUpdates(t *testing.T) { handler.On("CreateURL", mock.Anything).Return("", nil).Maybe() resolved := make(mmclienttypes.ResolvedMarketMap) - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: marketMap, } resolved[chains[0]] = mmclienttypes.NewMarketMapResult(&resp, time.Now()) @@ -150,7 +149,7 @@ func TestListenForMarketMapUpdates(t *testing.T) { handler.On("CreateURL", mock.Anything).Return("", nil).Maybe() resolved := make(mmclienttypes.ResolvedMarketMap) - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: marketMap, } resolved[chains[0]] = mmclienttypes.NewMarketMapResult(&resp, time.Now()) @@ -187,7 +186,7 @@ func TestListenForMarketMapUpdates(t *testing.T) { handler.On("CreateURL", mock.Anything).Return("", nil).Maybe() resolved := make(mmclienttypes.ResolvedMarketMap) - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: marketMap, } resolved[chains[0]] = mmclienttypes.NewMarketMapResult(&resp, time.Now()) @@ -226,7 +225,7 @@ func TestListenForMarketMapUpdates(t *testing.T) { handler.On("CreateURL", mock.Anything).Return("", nil).Maybe() resolved := make(mmclienttypes.ResolvedMarketMap) - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: marketMap, } resolved[chains[0]] = mmclienttypes.NewMarketMapResult(&resp, time.Now()) @@ -261,7 +260,7 @@ func TestListenForMarketMapUpdates(t *testing.T) { o.Stop() // Check that the market map was written to the path. - mm, err := types.ReadMarketConfigFromFile(path) + mm, err := mmtypes.ReadMarketMapFromFile(path) require.NoError(t, err) require.Equal(t, o.GetMarketMap(), mm) diff --git a/oracle/orchestrator/update.go b/oracle/orchestrator/update.go index f98812533..8e6d68478 100644 --- a/oracle/orchestrator/update.go +++ b/oracle/orchestrator/update.go @@ -7,7 +7,6 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base" - providertypes "github.com/skip-mev/slinky/providers/types" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) @@ -25,14 +24,14 @@ func (o *ProviderOrchestrator) UpdateWithMarketMap(marketMap mmtypes.MarketMap) // Iterate over all of the existing providers and update their market maps. for name, state := range o.providers { - providerMarketMap, err := types.ProviderMarketMapFromMarketMap(name, marketMap) + providerTickers, err := types.ProviderTickersFromMarketMap(name, marketMap) if err != nil { o.logger.Error("failed to create provider market map", zap.String("provider", name), zap.Error(err)) return err } // Update the provider's state. - updatedState, err := o.UpdateProviderState(providerMarketMap, state) + updatedState, err := o.UpdateProviderState(providerTickers, state) if err != nil { o.logger.Error("failed to update provider state", zap.String("provider", name), zap.Error(err)) return err @@ -51,40 +50,16 @@ func (o *ProviderOrchestrator) UpdateWithMarketMap(marketMap mmtypes.MarketMap) // UpdateProviderState updates the provider's state based on the market map. Specifically, // this will update the provider's query handler and the provider's market map. -func (o *ProviderOrchestrator) UpdateProviderState(marketMap types.ProviderMarketMap, state ProviderState) (ProviderState, error) { +func (o *ProviderOrchestrator) UpdateProviderState(providerTickers []types.ProviderTicker, state ProviderState) (ProviderState, error) { provider := state.Provider - tickers := marketMap.GetTickers() - o.logger.Info("updating provider state", zap.String("provider_state", provider.Name())) - switch provider.Type() { - case providertypes.API: - // Create and update the API query handler. - handler, err := o.createAPIQueryHandler(state.Cfg, marketMap) - if err != nil { - return state, err - } - - provider.Update( - base.WithNewAPIHandler(handler), - base.WithNewIDs[mmtypes.Ticker, *big.Int](marketMap.GetTickers()), - ) - case providertypes.WebSockets: - // Create and update the WebSocket query handler. - handler, err := o.createWebSocketQueryHandler(state.Cfg, marketMap) - if err != nil { - return state, err - } - - provider.Update( - base.WithNewWebSocketHandler(handler), - base.WithNewIDs[mmtypes.Ticker, *big.Int](marketMap.GetTickers()), - ) - } + o.logger.Info("updating provider state", zap.String("provider_state", provider.Name())) + provider.Update(base.WithNewIDs[types.ProviderTicker, *big.Float](providerTickers)) switch { - case len(tickers) == 0: + case len(providerTickers) == 0: provider.Stop() - case len(tickers) > 0 && !provider.IsRunning(): + case len(providerTickers) > 0 && !provider.IsRunning(): o.wg.Add(1) go func() { defer o.wg.Done() diff --git a/oracle/orchestrator/update_test.go b/oracle/orchestrator/update_test.go index dacc9de2c..bb5f685ce 100644 --- a/oracle/orchestrator/update_test.go +++ b/oracle/orchestrator/update_test.go @@ -7,7 +7,6 @@ import ( "github.com/stretchr/testify/require" - "github.com/skip-mev/slinky/oracle/constants" "github.com/skip-mev/slinky/oracle/orchestrator" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/apis/binance" @@ -19,7 +18,7 @@ import ( ) func TestUpdateWithMarketMap(t *testing.T) { - t.Run("bad market map is reject", func(t *testing.T) { + t.Run("bad market map is rejected", func(t *testing.T) { o, err := orchestrator.NewProviderOrchestrator( oracleCfg, orchestrator.WithLogger(logger), @@ -30,7 +29,7 @@ func TestUpdateWithMarketMap(t *testing.T) { require.NoError(t, o.Init()) err = o.UpdateWithMarketMap(mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ + Markets: map[string]mmtypes.Market{ "bad": {}, }, }) @@ -57,14 +56,34 @@ func TestUpdateWithMarketMap(t *testing.T) { providers = o.GetProviderState() + cbTickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) + require.NoError(t, err) + // Check the state after the update. coinbaseState, ok := providers[coinbase.Name] require.True(t, ok) - checkProviderState(t, []mmtypes.Ticker{constants.BITCOIN_USD, constants.ETHEREUM_USD}, coinbase.Name, providertypes.API, false, coinbaseState) + checkProviderState( + t, + cbTickers, + coinbase.Name, + providertypes.API, + false, + coinbaseState, + ) + + okxTickers, err := types.ProviderTickersFromMarketMap(okx.Name, marketMap) + require.NoError(t, err) okxState, ok := providers[okx.Name] require.True(t, ok) - checkProviderState(t, []mmtypes.Ticker{constants.BITCOIN_USD, constants.ETHEREUM_USD}, okx.Name, providertypes.WebSockets, false, okxState) + checkProviderState( + t, + okxTickers, + okx.Name, + providertypes.WebSockets, + false, + okxState, + ) binanceState, ok := providers[binance.Name] require.True(t, ok) @@ -102,18 +121,45 @@ func TestUpdateWithMarketMap(t *testing.T) { providers = o.GetProviderState() require.Len(t, providers, 3) + cbTickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) + require.NoError(t, err) + // Check the state after the update. coinbaseState, ok := providers[coinbase.Name] require.True(t, ok) - checkProviderState(t, []mmtypes.Ticker{constants.BITCOIN_USD, constants.ETHEREUM_USD}, coinbase.Name, providertypes.API, true, coinbaseState) + checkProviderState( + t, + cbTickers, + coinbase.Name, + providertypes.API, + true, + coinbaseState, + ) + + okxTickers, err := types.ProviderTickersFromMarketMap(okx.Name, marketMap) + require.NoError(t, err) okxState, ok := providers[okx.Name] require.True(t, ok) - checkProviderState(t, []mmtypes.Ticker{constants.BITCOIN_USD, constants.ETHEREUM_USD}, okx.Name, providertypes.WebSockets, true, okxState) + checkProviderState( + t, + okxTickers, + okx.Name, + providertypes.WebSockets, + true, + okxState, + ) binanceState, ok := providers[binance.Name] require.True(t, ok) - checkProviderState(t, nil, binance.Name, providertypes.API, false, binanceState) + checkProviderState( + t, + nil, + binance.Name, + providertypes.API, + false, + binanceState, + ) // Stop the providers. o.Stop() @@ -214,8 +260,6 @@ func TestUpdateWithMarketMap(t *testing.T) { } func TestUpdateProviderState(t *testing.T) { - expectedTickers := []mmtypes.Ticker{constants.BITCOIN_USD, constants.ETHEREUM_USD} - t.Run("can update a single api provider state with no configuration and non-running", func(t *testing.T) { o, err := orchestrator.NewProviderOrchestrator( oracleCfg, @@ -226,7 +270,7 @@ func TestUpdateProviderState(t *testing.T) { require.NoError(t, err) require.NoError(t, o.Init()) - providerMarketMap, err := types.ProviderMarketMapFromMarketMap(coinbase.Name, marketMap) + tickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) require.NoError(t, err) providers := o.GetProviderState() @@ -238,11 +282,11 @@ func TestUpdateProviderState(t *testing.T) { // Check the state before any modifications are done. checkProviderState(t, nil, coinbase.Name, providertypes.API, false, providerState) - updatedState, err := o.UpdateProviderState(providerMarketMap, providerState) + updatedState, err := o.UpdateProviderState(tickers, providerState) require.NoError(t, err) // Check the state after the update. - checkProviderState(t, expectedTickers, coinbase.Name, providertypes.API, false, updatedState) + checkProviderState(t, tickers, coinbase.Name, providertypes.API, false, updatedState) }) t.Run("can update a single api provider state with no configuration and running", func(t *testing.T) { @@ -264,7 +308,7 @@ func TestUpdateProviderState(t *testing.T) { time.Sleep(500 * time.Millisecond) - providerMarketMap, err := types.ProviderMarketMapFromMarketMap(coinbase.Name, marketMap) + tickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) require.NoError(t, err) providers := o.GetProviderState() @@ -276,13 +320,13 @@ func TestUpdateProviderState(t *testing.T) { // Check the state before any modifications are done. checkProviderState(t, nil, coinbase.Name, providertypes.API, false, providerState) - updatedState, err := o.UpdateProviderState(providerMarketMap, providerState) + updatedState, err := o.UpdateProviderState(tickers, providerState) require.NoError(t, err) time.Sleep(1000 * time.Millisecond) // Check the state after the update. - checkProviderState(t, expectedTickers, coinbase.Name, providertypes.API, true, updatedState) + checkProviderState(t, tickers, coinbase.Name, providertypes.API, true, updatedState) o.Stop() require.Eventually( @@ -312,13 +356,13 @@ func TestUpdateProviderState(t *testing.T) { providerState, ok := providers[coinbase.Name] require.True(t, ok) + tickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) + require.NoError(t, err) + // Check the state before any modifications are done. - checkProviderState(t, expectedTickers, coinbase.Name, providertypes.API, false, providerState) + checkProviderState(t, tickers, coinbase.Name, providertypes.API, false, providerState) - pMarketMap := types.ProviderMarketMap{ - Name: coinbase.Name, - } - updatedState, err := o.UpdateProviderState(pMarketMap, providerState) + updatedState, err := o.UpdateProviderState(nil, providerState) require.NoError(t, err) time.Sleep(1000 * time.Millisecond) @@ -354,13 +398,12 @@ func TestUpdateProviderState(t *testing.T) { providerState, ok := providers[coinbase.Name] require.True(t, ok) - // Check the state before any modifications are done. - checkProviderState(t, expectedTickers, coinbase.Name, providertypes.API, true, providerState) + tickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) + require.NoError(t, err) - pMarketMap := types.ProviderMarketMap{ - Name: coinbase.Name, - } - updatedState, err := o.UpdateProviderState(pMarketMap, providerState) + // Check the state before any modifications are done. + checkProviderState(t, tickers, coinbase.Name, providertypes.API, true, providerState) + updatedState, err := o.UpdateProviderState(nil, providerState) require.NoError(t, err) time.Sleep(1000 * time.Millisecond) @@ -389,7 +432,7 @@ func TestUpdateProviderState(t *testing.T) { require.NoError(t, err) require.NoError(t, o.Init()) - providerMarketMap, err := types.ProviderMarketMapFromMarketMap(okx.Name, marketMap) + tickers, err := types.ProviderTickersFromMarketMap(coinbase.Name, marketMap) require.NoError(t, err) providers := o.GetProviderState() @@ -401,11 +444,11 @@ func TestUpdateProviderState(t *testing.T) { // Check the state before any modifications are done. checkProviderState(t, nil, okx.Name, providertypes.WebSockets, false, providerState) - updatedState, err := o.UpdateProviderState(providerMarketMap, providerState) + updatedState, err := o.UpdateProviderState(tickers, providerState) require.NoError(t, err) // Check the state after the update. - checkProviderState(t, expectedTickers, okx.Name, providertypes.WebSockets, false, updatedState) + checkProviderState(t, tickers, okx.Name, providertypes.WebSockets, false, updatedState) o.Stop() require.Eventually( @@ -436,7 +479,7 @@ func TestUpdateProviderState(t *testing.T) { }() time.Sleep(3 * time.Millisecond) - providerMarketMap, err := types.ProviderMarketMapFromMarketMap(okx.Name, marketMap) + tickers, err := types.ProviderTickersFromMarketMap(okx.Name, marketMap) require.NoError(t, err) providers := o.GetProviderState() @@ -448,13 +491,13 @@ func TestUpdateProviderState(t *testing.T) { // Check the state before any modifications are done. checkProviderState(t, nil, okx.Name, providertypes.WebSockets, false, providerState) - updatedState, err := o.UpdateProviderState(providerMarketMap, providerState) + updatedState, err := o.UpdateProviderState(tickers, providerState) require.NoError(t, err) time.Sleep(3 * time.Millisecond) // Check the state after the update. - checkProviderState(t, expectedTickers, okx.Name, providertypes.WebSockets, true, updatedState) + checkProviderState(t, tickers, okx.Name, providertypes.WebSockets, true, updatedState) o.Stop() require.Eventually( @@ -484,13 +527,12 @@ func TestUpdateProviderState(t *testing.T) { providerState, ok := providers[okx.Name] require.True(t, ok) - // Check the state before any modifications are done. - checkProviderState(t, expectedTickers, okx.Name, providertypes.WebSockets, false, providerState) + tickers, err := types.ProviderTickersFromMarketMap(okx.Name, marketMap) + require.NoError(t, err) - pMarketMap := types.ProviderMarketMap{ - Name: okx.Name, - } - updatedState, err := o.UpdateProviderState(pMarketMap, providerState) + // Check the state before any modifications are done. + checkProviderState(t, tickers, okx.Name, providertypes.WebSockets, false, providerState) + updatedState, err := o.UpdateProviderState(nil, providerState) require.NoError(t, err) time.Sleep(1000 * time.Millisecond) @@ -534,13 +576,12 @@ func TestUpdateProviderState(t *testing.T) { providerState, ok := providers[okx.Name] require.True(t, ok) - // Check the state before any modifications are done. - checkProviderState(t, expectedTickers, okx.Name, providertypes.WebSockets, true, providerState) + tickers, err := types.ProviderTickersFromMarketMap(okx.Name, marketMap) + require.NoError(t, err) - pMarketMap := types.ProviderMarketMap{ - Name: okx.Name, - } - updatedState, err := o.UpdateProviderState(pMarketMap, providerState) + // Check the state before any modifications are done. + checkProviderState(t, tickers, okx.Name, providertypes.WebSockets, true, providerState) + updatedState, err := o.UpdateProviderState(nil, providerState) require.NoError(t, err) time.Sleep(1000 * time.Millisecond) diff --git a/oracle/providers_test.go b/oracle/providers_test.go index 5212b0dcd..f9ece7d5a 100644 --- a/oracle/providers_test.go +++ b/oracle/providers_test.go @@ -11,24 +11,24 @@ import ( "github.com/skip-mev/slinky/oracle" "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" + "github.com/skip-mev/slinky/pkg/math/median" "github.com/skip-mev/slinky/providers/base/testutils" providertypes "github.com/skip-mev/slinky/providers/types" providermocks "github.com/skip-mev/slinky/providers/types/mocks" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) func (s *OracleTestSuite) TestProviders() { testCases := []struct { name string factory types.PriceProviderFactoryI - expectedPrices types.TickerPrices + expectedPrices types.AggregatorPrices }{ { name: "1 provider with no prices", factory: func( config.OracleConfig, ) ([]types.PriceProviderI, error) { - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( + provider := testutils.CreateAPIProviderWithGetResponses[types.ProviderTicker, *big.Float]( s.T(), s.logger, providerCfg1, @@ -40,7 +40,7 @@ func (s *OracleTestSuite) TestProviders() { providers := []types.PriceProviderI{provider} return providers, nil }, - expectedPrices: types.TickerPrices{}, + expectedPrices: types.AggregatorPrices{}, }, { name: "1 provider with prices", @@ -49,13 +49,13 @@ func (s *OracleTestSuite) TestProviders() { ) ([]types.PriceProviderI, error) { resolved := types.ResolvedPrices{ s.currencyPairs[0]: { - Value: big.NewInt(100), + Value: big.NewFloat(100), Timestamp: time.Date(9999, 1, 1, 0, 0, 0, 0, time.UTC), }, } - response := providertypes.NewGetResponse[mmtypes.Ticker, *big.Int](resolved, nil) - responses := []providertypes.GetResponse[mmtypes.Ticker, *big.Int]{response} - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( + response := providertypes.NewGetResponse[types.ProviderTicker, *big.Float](resolved, nil) + responses := []providertypes.GetResponse[types.ProviderTicker, *big.Float]{response} + provider := testutils.CreateAPIProviderWithGetResponses[types.ProviderTicker, *big.Float]( s.T(), s.logger, providerCfg1, @@ -67,8 +67,8 @@ func (s *OracleTestSuite) TestProviders() { providers := []types.PriceProviderI{provider} return providers, nil }, - expectedPrices: types.TickerPrices{ - s.currencyPairs[0]: big.NewInt(100), + expectedPrices: types.AggregatorPrices{ + s.currencyPairs[0].String(): big.NewFloat(100), }, }, { @@ -78,13 +78,13 @@ func (s *OracleTestSuite) TestProviders() { ) ([]types.PriceProviderI, error) { resolved := types.ResolvedPrices{ s.currencyPairs[0]: { - Value: big.NewInt(100), + Value: big.NewFloat(100), Timestamp: time.Date(9999, 1, 1, 0, 0, 0, 0, time.UTC), }, } - response := providertypes.NewGetResponse[mmtypes.Ticker, *big.Int](resolved, nil) - responses := []providertypes.GetResponse[mmtypes.Ticker, *big.Int]{response} - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( + response := providertypes.NewGetResponse[types.ProviderTicker, *big.Float](resolved, nil) + responses := []providertypes.GetResponse[types.ProviderTicker, *big.Float]{response} + provider := testutils.CreateAPIProviderWithGetResponses[types.ProviderTicker, *big.Float]( s.T(), s.logger, providerCfg1, @@ -95,13 +95,13 @@ func (s *OracleTestSuite) TestProviders() { resolved2 := types.ResolvedPrices{ s.currencyPairs[0]: { - Value: big.NewInt(200), + Value: big.NewFloat(200), Timestamp: time.Date(9999, 1, 1, 0, 0, 0, 0, time.UTC), }, } - response2 := providertypes.NewGetResponse[mmtypes.Ticker, *big.Int](resolved2, nil) - responses2 := []providertypes.GetResponse[mmtypes.Ticker, *big.Int]{response2} - provider2 := testutils.CreateWebSocketProviderWithGetResponses[mmtypes.Ticker, *big.Int]( + response2 := providertypes.NewGetResponse[types.ProviderTicker, *big.Float](resolved2, nil) + responses2 := []providertypes.GetResponse[types.ProviderTicker, *big.Float]{response2} + provider2 := testutils.CreateWebSocketProviderWithGetResponses[types.ProviderTicker, *big.Float]( s.T(), time.Second*2, s.currencyPairs, @@ -113,8 +113,8 @@ func (s *OracleTestSuite) TestProviders() { providers := []types.PriceProviderI{provider, provider2} return providers, nil }, - expectedPrices: types.TickerPrices{ - s.currencyPairs[0]: big.NewInt(150), + expectedPrices: types.AggregatorPrices{ + s.currencyPairs[0].String(): big.NewFloat(150), }, }, { @@ -124,13 +124,13 @@ func (s *OracleTestSuite) TestProviders() { ) ([]types.PriceProviderI, error) { resolved := types.ResolvedPrices{ s.currencyPairs[0]: { - Value: big.NewInt(100), + Value: big.NewFloat(100), Timestamp: time.Date(9999, 1, 1, 0, 0, 0, 0, time.UTC), }, } - response := providertypes.NewGetResponse[mmtypes.Ticker, *big.Int](resolved, nil) - responses := []providertypes.GetResponse[mmtypes.Ticker, *big.Int]{response} - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( + response := providertypes.NewGetResponse[types.ProviderTicker, *big.Float](resolved, nil) + responses := []providertypes.GetResponse[types.ProviderTicker, *big.Float]{response} + provider := testutils.CreateAPIProviderWithGetResponses[types.ProviderTicker, *big.Float]( s.T(), s.logger, providerCfg1, @@ -142,8 +142,8 @@ func (s *OracleTestSuite) TestProviders() { providers := []types.PriceProviderI{provider, s.noStartProvider("provider2")} return providers, nil }, - expectedPrices: types.TickerPrices{ - s.currencyPairs[0]: big.NewInt(100), + expectedPrices: types.AggregatorPrices{ + s.currencyPairs[0].String(): big.NewFloat(100), }, }, { @@ -153,13 +153,13 @@ func (s *OracleTestSuite) TestProviders() { ) ([]types.PriceProviderI, error) { resolved := types.ResolvedPrices{ s.currencyPairs[0]: { - Value: big.NewInt(100), + Value: big.NewFloat(100), Timestamp: time.Date(1738, 1, 1, 0, 0, 0, 0, time.UTC), }, } - response := providertypes.NewGetResponse[mmtypes.Ticker, *big.Int](resolved, nil) - responses := []providertypes.GetResponse[mmtypes.Ticker, *big.Int]{response} - provider := testutils.CreateAPIProviderWithGetResponses[mmtypes.Ticker, *big.Int]( + response := providertypes.NewGetResponse[types.ProviderTicker, *big.Float](resolved, nil) + responses := []providertypes.GetResponse[types.ProviderTicker, *big.Float]{response} + provider := testutils.CreateAPIProviderWithGetResponses[types.ProviderTicker, *big.Float]( s.T(), s.logger, providerCfg1, @@ -171,7 +171,7 @@ func (s *OracleTestSuite) TestProviders() { providers := []types.PriceProviderI{provider} return providers, nil }, - expectedPrices: types.TickerPrices{}, + expectedPrices: types.AggregatorPrices{}, }, } @@ -197,6 +197,7 @@ func (s *OracleTestSuite) TestProviders() { oracle.WithUpdateInterval(cfg.UpdateInterval), oracle.WithLogger(s.logger), oracle.WithProviders(providers), + oracle.WithAggregateFunction(median.ComputeMedian()), ) s.Require().NoError(err) @@ -234,7 +235,7 @@ func (s *OracleTestSuite) TestProviders() { } func (s *OracleTestSuite) noStartProvider(name string) types.PriceProviderI { - provider := providermocks.NewProvider[mmtypes.Ticker, *big.Int](s.T()) + provider := providermocks.NewProvider[types.ProviderTicker, *big.Float](s.T()) provider.On("Name").Return(name).Maybe() provider.On("Start", mock.Anything).Return(fmt.Errorf("no rizz start")).Maybe() diff --git a/oracle/types/market.go b/oracle/types/market.go index 47611a944..79f635688 100644 --- a/oracle/types/market.go +++ b/oracle/types/market.go @@ -1,160 +1,87 @@ package types import ( - "encoding/json" "fmt" - "os" + pkgtypes "github.com/skip-mev/slinky/pkg/types" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -type ( - // TickerToProviderConfig is a type alias for the map of tickers to their respective - // provider configurations. - TickerToProviderConfig = map[mmtypes.Ticker]mmtypes.ProviderConfig - - // ProviderMarketMap provides a simple adapter of what the market map module expects - // from a provider and how the provider configures its markets. It provides a bi-directional - // mapping between on-chain and off-chain markets. Every ProviderMarketMap is expected to be - // constructed from a given market map module configuration. - ProviderMarketMap struct { - // Name is the name of the provider. - Name string - - // TickerConfigs is a map of tickers to their respective off-chain markets as - // configured by the market map module. - TickerConfigs TickerToProviderConfig - - // OffChainMap is a map of tickers to their respective on-chain markets. - OffChainMap map[string]mmtypes.Ticker - } -) - -// ProviderMarketMapFromMarketMap returns a provider market map from a market map provided by the -// market map module. -func ProviderMarketMapFromMarketMap(name string, marketMap mmtypes.MarketMap) (ProviderMarketMap, error) { +// ProviderTickersFromMarketMap returns the set of provider tickers a given provider should +// be providing data for based on the market map. +func ProviderTickersFromMarketMap( + name string, + marketMap mmtypes.MarketMap, +) ([]ProviderTicker, error) { if err := marketMap.ValidateBasic(); err != nil { - return ProviderMarketMap{}, fmt.Errorf("invalid market map: %w", err) + return nil, fmt.Errorf("invalid market map: %w", err) } - // Iterate over the providers and their respective tickers. - tickers := make(TickerToProviderConfig) - for tickerStr, config := range marketMap.Providers { - ticker, ok := marketMap.Tickers[tickerStr] - if !ok { - return ProviderMarketMap{}, fmt.Errorf("ticker %s not found in market map", tickerStr) - } - - for _, provider := range config.Providers { - if provider.Name != name { + var ( + // Track all of the tickers that the provider will be providing data for. + providerTickers = make([]ProviderTicker, 0) + // Maintain a set of off-chain tickers that have been seen to avoid duplicates. + // Notably, the side-car provider enforces a uniquness constraint for off-chain tickers. + seenOffChainTickers = make(map[string]struct{}) + ) + + // Iterate through every single market and its provider configurations to find the + // provider configurations that match the provider name. + for _, market := range marketMap.Markets { + for _, cfg := range market.ProviderConfigs { + if cfg.Name != name { + continue + } + if _, ok := seenOffChainTickers[cfg.OffChainTicker]; ok { continue } - tickers[ticker] = provider - break + providerTicker := NewProviderTicker( + cfg.OffChainTicker, + cfg.Metadata_JSON, + ) + providerTickers = append(providerTickers, providerTicker) + seenOffChainTickers[cfg.OffChainTicker] = struct{}{} } } - return NewProviderMarketMap(name, tickers) + return providerTickers, nil } -// NewProviderMarketMap returns a new provider market map. -func NewProviderMarketMap(name string, tickerConfigs TickerToProviderConfig) (ProviderMarketMap, error) { - if len(name) == 0 { - return ProviderMarketMap{}, fmt.Errorf("provider name cannot be empty") - } +// CurrencyPairsToProviderTickers is a map of tickers to provider tickers. This should be +// utilized by providers to configure the tickers they will be providing data for. +type CurrencyPairsToProviderTickers map[pkgtypes.CurrencyPair]DefaultProviderTicker - if len(tickerConfigs) == 0 { - return ProviderMarketMap{ - Name: name, - TickerConfigs: make(map[mmtypes.Ticker]mmtypes.ProviderConfig), - OffChainMap: make(map[string]mmtypes.Ticker), - }, nil - } +// ToProviderTickers converts the map to a list of provider tickers. +func (tpt CurrencyPairsToProviderTickers) ToProviderTickers() []ProviderTicker { + providerTickers := make([]ProviderTicker, len(tpt)) - offChainMap := make(map[string]mmtypes.Ticker) - for ticker, config := range tickerConfigs { - if err := ticker.ValidateBasic(); err != nil { - return ProviderMarketMap{}, fmt.Errorf("invalid ticker %s: %w", ticker, err) - } - - if err := config.ValidateBasic(); err != nil { - return ProviderMarketMap{}, fmt.Errorf("invalid provider config for %s: %w", ticker, err) - } - - if config.Name != name { - return ProviderMarketMap{}, fmt.Errorf("expected provider config name %s, got %s", name, config.Name) - } - - offChainMap[config.OffChainTicker] = ticker + i := 0 + for _, ticker := range tpt { + providerTickers[i] = ticker + i++ } - return ProviderMarketMap{ - Name: name, - TickerConfigs: tickerConfigs, - OffChainMap: offChainMap, - }, nil -} - -// GetTickers returns the tickers from the provider market map. -func (pmm *ProviderMarketMap) GetTickers() []mmtypes.Ticker { - tickers := make([]mmtypes.Ticker, 0, len(pmm.TickerConfigs)) - for ticker := range pmm.TickerConfigs { - tickers = append(tickers, ticker) - } - return tickers + return providerTickers } -// ValidateBasic performs basic validation on the provider market map. -func (pmm *ProviderMarketMap) ValidateBasic() error { - if len(pmm.Name) == 0 { - return fmt.Errorf("provider name cannot be empty") - } - if len(pmm.OffChainMap) != len(pmm.TickerConfigs) { - return fmt.Errorf("off-chain map length mismatch") +// MustGetProviderTicker returns the provider ticker for the given currency pair. +// This function is mostly used for testing. +func (tpt CurrencyPairsToProviderTickers) MustGetProviderTicker(cp pkgtypes.CurrencyPair) ProviderTicker { + providerTicker, ok := tpt[cp] + if !ok { + panic(fmt.Sprintf("currency pair %s not found", cp.String())) } - - for ticker, config := range pmm.TickerConfigs { - if err := ticker.ValidateBasic(); err != nil { - return fmt.Errorf("invalid ticker %s: %w", ticker, err) - } - - if err := config.ValidateBasic(); err != nil { - return fmt.Errorf("invalid provider config for %s: %w", ticker, err) - } - - t, ok := pmm.OffChainMap[config.OffChainTicker] - if !ok { - return fmt.Errorf("off-chain ticker %s not found in off-chain map", config.OffChainTicker) - } - - if t != ticker { - return fmt.Errorf("off-chain ticker %s does not match on-chain ticker %s", config.OffChainTicker, ticker) - } - } - - return nil + return providerTicker } -// ReadMarketConfigFromFile reads a market map configuration from a file at the given path. -func ReadMarketConfigFromFile(path string) (mmtypes.MarketMap, error) { - // Initialize the struct to hold the configuration - var config mmtypes.MarketMap - - // Read the entire file at the given path - data, err := os.ReadFile(path) - if err != nil { - return config, fmt.Errorf("error reading config file: %w", err) +// MustGetProviderConfig returns the provider config for the given currency pair. +// This function is mostly used for testing. +func (tpt CurrencyPairsToProviderTickers) MustGetProviderConfig(name string, cp pkgtypes.CurrencyPair) mmtypes.ProviderConfig { + providerTicker := tpt.MustGetProviderTicker(cp) + return mmtypes.ProviderConfig{ + Name: name, + OffChainTicker: providerTicker.GetOffChainTicker(), + Metadata_JSON: providerTicker.GetJSON(), } - - // Unmarshal the JSON data into the config struct - if err := json.Unmarshal(data, &config); err != nil { - return config, fmt.Errorf("error unmarshalling config JSON: %w", err) - } - - if err := config.ValidateBasic(); err != nil { - return config, fmt.Errorf("error validating config: %w", err) - } - - return config, nil } diff --git a/oracle/types/market_test.go b/oracle/types/market_test.go index 729ff2fda..c60d1474e 100644 --- a/oracle/types/market_test.go +++ b/oracle/types/market_test.go @@ -5,229 +5,145 @@ import ( "github.com/stretchr/testify/require" - "github.com/skip-mev/slinky/oracle/constants" "github.com/skip-mev/slinky/oracle/types" + pkgtypes "github.com/skip-mev/slinky/pkg/types" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -func TestProviderMarketMap(t *testing.T) { - testCases := []struct { - name string - providerName string - configs types.TickerToProviderConfig - expErr bool +func TestProviderTickersFromMarketMap(t *testing.T) { + cases := []struct { + name string + provider string + market mmtypes.MarketMap + expected []types.ProviderTicker + err bool }{ { - name: "empty configs", - providerName: "test", - configs: types.TickerToProviderConfig{}, - expErr: false, + name: "empty market map", + provider: "test", + market: mmtypes.MarketMap{}, + expected: nil, + err: false, }, { - name: "empty provider name", - providerName: "", - configs: types.TickerToProviderConfig{ - constants.BITCOIN_USD: { - Name: "test", - OffChainTicker: "BTC-USD", + name: "invalid market map", + provider: "test", + market: mmtypes.MarketMap{ + Markets: map[string]mmtypes.Market{ + "test": {}, }, }, - expErr: true, + expected: nil, + err: true, }, { - name: "empty off-chain ticker", - providerName: "test", - configs: types.TickerToProviderConfig{ - constants.BITCOIN_USD: { - Name: "test", - OffChainTicker: "", - }, - }, - expErr: true, - }, - { - name: "invalid ticker", - providerName: "test", - configs: types.TickerToProviderConfig{ - mmtypes.NewTicker("BTC", "USD", 8, 0): { - Name: "test", - OffChainTicker: "BTC-USD", - }, - }, - expErr: true, - }, - { - name: "valid configs", - providerName: "test", - configs: types.TickerToProviderConfig{ - constants.BITCOIN_USD: { - Name: "test", - OffChainTicker: "BTC-USD", - }, - constants.BITCOIN_USDC: { - Name: "test", - OffChainTicker: "BTC-USDC", - }, - }, - expErr: false, - }, - { - name: "mismatch provider name and config", - providerName: "test", - configs: types.TickerToProviderConfig{ - constants.BITCOIN_USD: { - Name: "invalid", - OffChainTicker: "BTC-USD", - }, - }, - expErr: true, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - pmap, err := types.NewProviderMarketMap(tc.providerName, tc.configs) - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - - err = pmap.ValidateBasic() - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - }) - } -} - -func TestProviderMarketMapFromMarketMap(t *testing.T) { - testCases := []struct { - name string - marketMap mmtypes.MarketMap - providerName string - expectedMap types.ProviderMarketMap - expErr bool - }{ - { - name: "empty market map", - marketMap: mmtypes.MarketMap{}, - providerName: "coinbase", - expectedMap: types.ProviderMarketMap{ - Name: "coinbase", - TickerConfigs: make(map[mmtypes.Ticker]mmtypes.ProviderConfig), - OffChainMap: map[string]mmtypes.Ticker{}, - }, - expErr: false, - }, - { - name: "valid market map with no entries for the given provider", - marketMap: mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]mmtypes.Providers{ - constants.BITCOIN_USD.String(): { - Providers: []mmtypes.ProviderConfig{ + name: "single market for the provider", + provider: "test", + market: mmtypes.MarketMap{ + Markets: map[string]mmtypes.Market{ + "BTC/USD": { + Ticker: mmtypes.NewTicker("BTC", "USD", 8, 1), + ProviderConfigs: []mmtypes.ProviderConfig{ { Name: "test", - OffChainTicker: "BTC-USD", + OffChainTicker: "BTC/USDT", + Metadata_JSON: "{}", }, }, }, }, }, - providerName: "coinbase", - expectedMap: types.ProviderMarketMap{ - Name: "coinbase", - TickerConfigs: make(map[mmtypes.Ticker]mmtypes.ProviderConfig), - OffChainMap: map[string]mmtypes.Ticker{}, + expected: []types.ProviderTicker{ + types.NewProviderTicker( + "BTC/USDT", + "{}", + ), }, - expErr: false, + err: false, }, { - name: "valid market map with entries for the given provider", - marketMap: mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]mmtypes.Providers{ - constants.BITCOIN_USD.String(): { - Providers: []mmtypes.ProviderConfig{ + name: "provider has no configs in market map", + provider: "test", + market: mmtypes.MarketMap{ + Markets: map[string]mmtypes.Market{ + "BTC/USD": { + Ticker: mmtypes.NewTicker("BTC", "USD", 8, 1), + ProviderConfigs: []mmtypes.ProviderConfig{ { - Name: "coinbase", - OffChainTicker: "BTC-USD", + Name: "other", + OffChainTicker: "BTC/USDT", + Metadata_JSON: "{}", }, }, }, }, }, - providerName: "coinbase", - expectedMap: types.ProviderMarketMap{ - Name: "coinbase", - TickerConfigs: types.TickerToProviderConfig{ - constants.BITCOIN_USD: { - Name: "coinbase", - OffChainTicker: "BTC-USD", - }, - }, - OffChainMap: map[string]mmtypes.Ticker{ - "BTC-USD": constants.BITCOIN_USD, - }, - }, - expErr: false, + expected: nil, + err: false, }, { - name: "multiple providers for the same ticker", - marketMap: mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]mmtypes.Providers{ - constants.BITCOIN_USD.String(): { - Providers: []mmtypes.ProviderConfig{ + name: "duplicate markets for the provider", + provider: "test", + market: mmtypes.MarketMap{ + Markets: map[string]mmtypes.Market{ + "ETH/USD": { + Ticker: mmtypes.NewTicker("ETH", "USD", 8, 1), + ProviderConfigs: []mmtypes.ProviderConfig{ { - Name: "coinbase", - OffChainTicker: "BTC-USD", + Name: "test", + OffChainTicker: "ETH/USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", + }, + Metadata_JSON: "{}", }, + }, + }, + "USDT/USD": { + Ticker: mmtypes.NewTicker("USDT", "USD", 8, 1), + ProviderConfigs: []mmtypes.ProviderConfig{ { Name: "test", - OffChainTicker: "BTCs-USD", + OffChainTicker: "ETH/USDT", + Invert: true, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "ETH", + Quote: "USD", + }, + Metadata_JSON: "{}", }, }, }, }, }, - providerName: "coinbase", - expectedMap: types.ProviderMarketMap{ - Name: "coinbase", - TickerConfigs: types.TickerToProviderConfig{ - constants.BITCOIN_USD: { - Name: "coinbase", - OffChainTicker: "BTC-USD", - }, - }, - OffChainMap: map[string]mmtypes.Ticker{ - "BTC-USD": constants.BITCOIN_USD, - }, + expected: []types.ProviderTicker{ + types.NewProviderTicker( + "ETH/USDT", + "{}", + ), }, - expErr: false, + err: false, }, } - for _, tc := range testCases { + for _, tc := range cases { t.Run(tc.name, func(t *testing.T) { - pmap, err := types.ProviderMarketMapFromMarketMap(tc.providerName, tc.marketMap) - if tc.expErr { + actual, err := types.ProviderTickersFromMarketMap(tc.provider, tc.market) + if tc.err { require.Error(t, err) - } else { - require.NoError(t, err) - require.Equal(t, tc.expectedMap.Name, pmap.Name) - require.Equal(t, tc.expectedMap.TickerConfigs, pmap.TickerConfigs) - require.Equal(t, tc.expectedMap.OffChainMap, pmap.OffChainMap) + return + } + + expectedCache := make(map[types.ProviderTicker]struct{}) + for _, ticker := range tc.expected { + expectedCache[ticker] = struct{}{} + } + actualCache := make(map[types.ProviderTicker]struct{}) + for _, ticker := range actual { + actualCache[ticker] = struct{}{} } + require.Equal(t, expectedCache, actualCache) }) } } diff --git a/oracle/types/oracle.go b/oracle/types/oracle.go index 5631dfb73..7cca59487 100644 --- a/oracle/types/oracle.go +++ b/oracle/types/oracle.go @@ -14,7 +14,6 @@ import ( wsmetrics "github.com/skip-mev/slinky/providers/base/websocket/metrics" providertypes "github.com/skip-mev/slinky/providers/types" "github.com/skip-mev/slinky/providers/types/factory" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) // ConfigType is the type of the API/WebSocket configuration. @@ -24,20 +23,20 @@ type ( // PriceProviderFactory is a type alias for the price provider factory. This // specifically only returns price providers that implement the provider interface // and the additional base provider methods. - PriceProviderFactory = factory.BaseProviderFactory[mmtypes.Ticker, *big.Int] + PriceProviderFactory = factory.BaseProviderFactory[ProviderTicker, *big.Float] // PriceProviderFactory is a type alias for the price provider factory. This // specifically only returns price providers that implement the provider interface. - PriceProviderFactoryI = factory.ProviderFactory[mmtypes.Ticker, *big.Int] + PriceProviderFactoryI = factory.ProviderFactory[ProviderTicker, *big.Float] // PriceProvider is a type alias for the base price provider. This specifically // implements the provider interface for the price provider along with the // additional base provider methods. - PriceProvider = base.Provider[mmtypes.Ticker, *big.Int] + PriceProvider = base.Provider[ProviderTicker, *big.Float] // PriceProviderI is a type alias for the price provider. This specifically // implements the provider interface for the price provider. - PriceProviderI = providertypes.Provider[mmtypes.Ticker, *big.Int] + PriceProviderI = providertypes.Provider[ProviderTicker, *big.Float] // PriceAPIQueryHandlerFactory is a type alias for the price API query handler factory. // This is responsible for creating the API query handler for the price provider. @@ -45,22 +44,21 @@ type ( logger *zap.Logger, cfg config.ProviderConfig, apiMetrics apimetrics.APIMetrics, - pMarketMap ProviderMarketMap, ) (PriceAPIQueryHandler, error) // PriceAPIFetcher is a type alias for the price API fetcher. This is responsible // for fetching the prices from the price provider. - PriceAPIFetcher = apihandlers.APIFetcher[mmtypes.Ticker, *big.Int] + PriceAPIFetcher = apihandlers.APIFetcher[ProviderTicker, *big.Float] // PriceAPIDataHandler is a type alias for the price API data handler. This // is responsible for parsing http responses and returning the resolved // and unresolved prices. - PriceAPIDataHandler = apihandlers.APIDataHandler[mmtypes.Ticker, *big.Int] + PriceAPIDataHandler = apihandlers.APIDataHandler[ProviderTicker, *big.Float] // PriceAPIQueryHandler is a type alias for the price API query handler. This // is responsible for building the API query for the price provider and // returning the resolved and unresolved prices. - PriceAPIQueryHandler = apihandlers.APIQueryHandler[mmtypes.Ticker, *big.Int] + PriceAPIQueryHandler = apihandlers.APIQueryHandler[ProviderTicker, *big.Float] // PriceWebSocketQueryHandlerFactory is a type alias for the price web socket query handler factory. // This is responsible for creating the web socket query handler for the price provider. @@ -68,72 +66,78 @@ type ( logger *zap.Logger, cfg config.ProviderConfig, wsMetrics wsmetrics.WebSocketMetrics, - pMarketMap ProviderMarketMap, ) (PriceWebSocketQueryHandler, error) // PriceWebSocketDataHandler is a type alias for the price web socket data handler. // This is responsible for parsing web socket messages and returning the resolved // and unresolved prices. - PriceWebSocketDataHandler = wshandlers.WebSocketDataHandler[mmtypes.Ticker, *big.Int] + PriceWebSocketDataHandler = wshandlers.WebSocketDataHandler[ProviderTicker, *big.Float] // PriceWebSocketQueryHandler is a type alias for the price web socket query handler. // This is responsible for building the web socket query for the price provider and // returning the resolved and unresolved prices. - PriceWebSocketQueryHandler = wshandlers.WebSocketQueryHandler[mmtypes.Ticker, *big.Int] + PriceWebSocketQueryHandler = wshandlers.WebSocketQueryHandler[ProviderTicker, *big.Float] // PriceResponse is a type alias for the price response. A price response is // composed of a map of resolved prices and a map of unresolved prices. Resolved // prices are the prices that were successfully fetched from the API, while // unresolved prices are the prices that were not successfully fetched from the API. - PriceResponse = providertypes.GetResponse[mmtypes.Ticker, *big.Int] + PriceResponse = providertypes.GetResponse[ProviderTicker, *big.Float] // ResolvedPrices is a type alias for the resolved prices. - ResolvedPrices = map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int] + ResolvedPrices = map[ProviderTicker]providertypes.ResolvedResult[*big.Float] // UnResolvedPrices is a type alias for the unresolved prices. - UnResolvedPrices = map[mmtypes.Ticker]providertypes.UnresolvedResult + UnResolvedPrices = map[ProviderTicker]providertypes.UnresolvedResult // TickerPrices is a type alias for the map of prices. This is a map of tickers i.e. // BTC/USD, ETH/USD, etc. to their respective prices. - TickerPrices = map[mmtypes.Ticker]*big.Int + TickerPrices = map[ProviderTicker]*big.Float + + // AggregatorPrices is a type alias for a map of off-chain ticker to the price. It is + // critical to note that the aggregator tracks prices indexed by off-chain tickers. When + // a final price is calculated (after aggregation), it is indexed by the canonical on-chain + // ticker. + AggregatorPrices = map[string]*big.Float // PriceAggregator is a type alias for the price aggregator. This is responsible for - // aggregating the resolved prices from the price providers. - PriceAggregator = aggregator.Aggregator[string, TickerPrices] + // aggregating the resolved prices from the price providers. This maps the + // provider -> off-chain-ticker -> price. + PriceAggregator = aggregator.Aggregator[string, AggregatorPrices] // PriceAggregationFn is a type alias for the price aggregation function. This function // is used to aggregate the resolved prices from the price providers. - PriceAggregationFn = aggregator.AggregateFn[string, TickerPrices] + PriceAggregationFn = aggregator.AggregateFn[string, AggregatorPrices] // AggregatedProviderPrices is a type alias for the aggregated provider prices. This is // a map of provider names to their respective ticker prices. - AggregatedProviderPrices = aggregator.AggregatedProviderData[string, TickerPrices] + AggregatedProviderPrices = aggregator.AggregatedProviderData[string, AggregatorPrices] ) var ( // NewPriceResult is a function alias for the new price result. - NewPriceResult = providertypes.NewResult[*big.Int] + NewPriceResult = providertypes.NewResult[*big.Float] // NewPricesResponse is a function alias for the new price response. - NewPriceResponse = providertypes.NewGetResponse[mmtypes.Ticker, *big.Int] + NewPriceResponse = providertypes.NewGetResponse[ProviderTicker, *big.Float] // NewPriceResponseWithErr is a function alias for the new price response with errors. - NewPriceResponseWithErr = providertypes.NewGetResponseWithErr[mmtypes.Ticker, *big.Int] + NewPriceResponseWithErr = providertypes.NewGetResponseWithErr[ProviderTicker, *big.Float] // NewPriceProvider is a function alias for the new price provider. - NewPriceProvider = base.NewProvider[mmtypes.Ticker, *big.Int] + NewPriceProvider = base.NewProvider[ProviderTicker, *big.Float] // NewPriceAPIQueryHandler is a function alias for the new API query handler meant to be // used by the price providers. - NewPriceAPIQueryHandler = apihandlers.NewAPIQueryHandler[mmtypes.Ticker, *big.Int] + NewPriceAPIQueryHandler = apihandlers.NewAPIQueryHandler[ProviderTicker, *big.Float] // NewPriceAPIQueryHandlerWithFetcher is a function alias for the new API query handler with fetcher. - NewPriceAPIQueryHandlerWithFetcher = apihandlers.NewAPIQueryHandlerWithFetcher[mmtypes.Ticker, *big.Int] + NewPriceAPIQueryHandlerWithFetcher = apihandlers.NewAPIQueryHandlerWithFetcher[ProviderTicker, *big.Float] // NewPriceWebSocketQueryHandler is a function alias for the new web socket query handler meant to be // used by the price providers. - NewPriceWebSocketQueryHandler = wshandlers.NewWebSocketQueryHandler[mmtypes.Ticker, *big.Int] + NewPriceWebSocketQueryHandler = wshandlers.NewWebSocketQueryHandler[ProviderTicker, *big.Float] // NewPriceAggregator is a function alias for the new price aggregator. - NewPriceAggregator = aggregator.NewDataAggregator[string, TickerPrices] + NewPriceAggregator = aggregator.NewDataAggregator[string, AggregatorPrices] ) diff --git a/oracle/types/provider.go b/oracle/types/provider.go new file mode 100644 index 000000000..c0d30af60 --- /dev/null +++ b/oracle/types/provider.go @@ -0,0 +1,94 @@ +package types + +import ( + "fmt" + "sync" +) + +type ( + // ProviderTicker is the interface for the ticker that provider's utilize/return. + ProviderTicker interface { + fmt.Stringer + + // GetOffChainTicker returns the off-chain representation for the ticker. + GetOffChainTicker() string + // GetJSON returns additional JSON data for the ticker. + GetJSON() string + } + + // DefaultProviderTicker is a basic implementation of the ProviderTicker interface. + // Provider's that utilize this implementation should be able to easily configure + // custom json data for their tickers. + DefaultProviderTicker struct { + OffChainTicker string + JSON string + } + + // ProviderTickers is a thread safe helper struct to manage a list of provider tickers. + ProviderTickers struct { + mut sync.Mutex + + cache map[string]ProviderTicker + } +) + +// NewProviderTicker returns a new provider ticker. +func NewProviderTicker( + offChain, json string, +) ProviderTicker { + return DefaultProviderTicker{ + OffChainTicker: offChain, + JSON: json, + } +} + +// OffChainTicker returns the off-chain representation for the ticker. +func (t DefaultProviderTicker) GetOffChainTicker() string { + return t.OffChainTicker +} + +// JSON returns additional JSON data for the ticker. +func (t DefaultProviderTicker) GetJSON() string { + return t.JSON +} + +// String returns the string representation of the provider ticker. +func (t DefaultProviderTicker) String() string { + return t.OffChainTicker +} + +// NewProviderTickers returns a new list of provider tickers. +func NewProviderTickers(tickers ...ProviderTicker) ProviderTickers { + cache := make(map[string]ProviderTicker) + for _, ticker := range tickers { + cache[ticker.GetOffChainTicker()] = ticker + } + return ProviderTickers{ + cache: cache, + } +} + +// FromOffChainTicker returns the provider ticker from the off-chain ticker. +func (t *ProviderTickers) FromOffChainTicker(offChain string) (ProviderTicker, bool) { + t.mut.Lock() + defer t.mut.Unlock() + + ticker, ok := t.cache[offChain] + return ticker, ok +} + +// Add adds a provider ticker to the list of provider tickers. +func (t *ProviderTickers) Add(ticker ProviderTicker) { + t.mut.Lock() + defer t.mut.Unlock() + + t.cache[ticker.GetOffChainTicker()] = ticker +} + +// Reset resets the provider tickers. +func (t *ProviderTickers) Reset() { + t.mut.Lock() + defer t.mut.Unlock() + + t.cache = make(map[string]ProviderTicker) +} diff --git a/pkg/math/math.go b/pkg/math/math.go index ab8298f1e..f5a798e4f 100644 --- a/pkg/math/math.go +++ b/pkg/math/math.go @@ -1,7 +1,9 @@ package math import ( + "fmt" "math/big" + "sort" "golang.org/x/exp/constraints" ) @@ -76,3 +78,79 @@ func BigFloatToBigInt(f *big.Float, decimals uint64) *big.Int { return result } + +// Float64StringToBigFloat converts a float64 string to a big.Float. +func Float64StringToBigFloat(s string) (*big.Float, error) { + bigFloat := new(big.Float) + _, ok := bigFloat.SetString(s) + if !ok { + return nil, fmt.Errorf("failed to set big.Float from string: %s", s) + } + return bigFloat, nil +} + +// ScaleBigFloat scales a big.Float by the given decimals. +func ScaleBigFloat(f *big.Float, decimals uint64) *big.Float { + bigFloat := new(big.Float) + factor := big.NewInt(1).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) + bigFloat.SetInt(factor) + + f.Mul(f, bigFloat) + + return f +} + +// SortBigFloats is a stable slices sort for an array of big.Floats. +func SortBigFloats(values []*big.Float) { + // Sort the values. + sort.SliceStable(values, func(i, j int) bool { + switch values[i].Cmp(values[j]) { + case -1: + return true + case 1: + return false + default: + return true + } + }) +} + +// CalculateMedian calculates the median from a list of big.Float. Returns an +// average if the number of values is even. +func CalculateMedian(values []*big.Float) *big.Float { + if len(values) == 0 { + return nil + } + SortBigFloats(values) + + middleIndex := len(values) / 2 + + // Calculate the median. + numValues := len(values) + var median *big.Float + if numValues%2 == 0 { // even + median = new(big.Float).Add(values[middleIndex-1], values[middleIndex]) + median = median.Quo(median, new(big.Float).SetUint64(2)) + } else { // odd + median = values[middleIndex] + } + + return median +} + +// GetScalingFactor returns the scaling factor for the price based on the difference between +// the token decimals in the erc20 token contracts or similar. +func GetScalingFactor( + first, second int64, +) *big.Float { + // Determine the scaling factor for the price. + decimalDiff := first - second + exp := new(big.Float).SetInt( + new(big.Int).Exp(big.NewInt(10), big.NewInt(Abs(decimalDiff)), nil), + ) + + if decimalDiff > 0 { + return exp + } + return new(big.Float).Quo(big.NewFloat(1), exp) +} diff --git a/pkg/math/math_test.go b/pkg/math/math_test.go index 7943448b0..0415247c4 100644 --- a/pkg/math/math_test.go +++ b/pkg/math/math_test.go @@ -271,3 +271,238 @@ func TestBigFloatToBigInt(t *testing.T) { }) } } + +func TestFloat64StringToBigFloat(t *testing.T) { + testCases := []struct { + name string + in string + out *big.Float + err bool + }{ + { + name: "zero", + in: "0", + out: big.NewFloat(0), + err: false, + }, + { + name: "1", + in: "1", + out: big.NewFloat(1), + err: false, + }, + { + name: "value has a lot of 0s", + in: "0.0000000000000001", // 1e-16 + out: big.NewFloat(1e-16), + err: false, + }, + { + name: "value is very large", + in: "420420420420420.420420420", + out: big.NewFloat(420420420420420.420420420), + err: false, + }, + } + + for _, tc := range testCases { + t.Run(tc.in, func(t *testing.T) { + out, err := math.Float64StringToBigFloat(tc.in) + if tc.err { + require.Error(t, err) + } else { + require.NoError(t, err) + require.Equal(t, tc.out.SetPrec(uint(40)), out.SetPrec(uint(40))) + } + }) + } +} + +func TestScaleBigFloat(t *testing.T) { + testCases := []struct { + name string + in *big.Float + decimals uint64 + out *big.Float + }{ + { + name: "zero", + in: big.NewFloat(0), + decimals: 6, + out: big.NewFloat(0), + }, + { + name: "1", + in: big.NewFloat(1), + decimals: 6, + out: big.NewFloat(1e6), + }, + { + name: "value that has more 0s than decimals", + in: big.NewFloat(1e-16), + decimals: 6, + out: big.NewFloat(1e-10), + }, + { + name: "value is very large", + in: big.NewFloat(420420420420420.420420420), + decimals: 6, + out: big.NewFloat(420420420420420.420420420e6), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + out := math.ScaleBigFloat(tc.in, tc.decimals) + require.Equal(t, tc.out.SetPrec(uint(40)), out.SetPrec(uint(40))) + }) + } +} + +func TestCalculateMedian(t *testing.T) { + testCases := []struct { + name string + values []*big.Float + expected *big.Float + }{ + { + name: "do nothing for nil slice", + values: nil, + expected: nil, + }, + { + name: "calculate median for even number of values", + values: []*big.Float{ + big.NewFloat(-2), + big.NewFloat(0), + big.NewFloat(10), + big.NewFloat(100), + }, + expected: big.NewFloat(5), + }, + { + name: "calculate median for odd number of values", + values: []*big.Float{ + big.NewFloat(10), + big.NewFloat(-2), + big.NewFloat(100), + big.NewFloat(0), + big.NewFloat(0), + }, + expected: big.NewFloat(0), + }, + { + "calculates median for even number of values with decimals", + []*big.Float{ + big.NewFloat(-2), + big.NewFloat(0), + big.NewFloat(0), + big.NewFloat(1), + big.NewFloat(10), + big.NewFloat(100), + }, + big.NewFloat(0.5), + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + require.Equal(t, tc.expected, math.CalculateMedian(tc.values)) + }) + } +} + +func TestSortBigInts(t *testing.T) { + testCases := []struct { + name string + values []*big.Float + expected []*big.Float + }{ + { + name: "do nothing for nil slice", + }, + { + name: "sort a slice", + values: []*big.Float{ + big.NewFloat(10), + big.NewFloat(-2), + big.NewFloat(100), + big.NewFloat(0), + big.NewFloat(0), + }, + expected: []*big.Float{ + big.NewFloat(-2), + big.NewFloat(0), + big.NewFloat(0), + big.NewFloat(10), + big.NewFloat(100), + }, + }, + { + name: "do nothing for same values", + values: []*big.Float{ + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(-2), + big.NewFloat(100), + big.NewFloat(0), + big.NewFloat(0), + }, + expected: []*big.Float{ + big.NewFloat(-2), + big.NewFloat(0), + big.NewFloat(0), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(10), + big.NewFloat(100), + }, + }, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + math.SortBigFloats(tc.values) + require.Equal(t, tc.expected, tc.values) + }) + } +} + +func TestGetScalingFactor(t *testing.T) { + t.Run("base and quote decimals for erc20 tokens are the same", func(t *testing.T) { + actual := math.GetScalingFactor( + 18, + 18, + ) + + expected := big.NewFloat(1) + require.Equal(t, expected.SetPrec(40), actual.SetPrec(40)) + }) + + t.Run("base decimals are greater than quote decimals for erc20 tokens", func(t *testing.T) { + actual := math.GetScalingFactor( + 18, + 6, + ) + + expected := big.NewFloat(1e12) + require.Equal(t, expected.SetPrec(40), actual.SetPrec(40)) + }) + + t.Run("quote decimals are greater than base decimals for erc20 tokens", func(t *testing.T) { + actual := math.GetScalingFactor( + 6, + 18, + ) + + expected := big.NewFloat(1e-12) + require.Equal(t, expected.SetPrec(40), actual.SetPrec(40)) + }) +} diff --git a/pkg/math/median/median.go b/pkg/math/median/median.go index f0a543168..31403b2fc 100644 --- a/pkg/math/median/median.go +++ b/pkg/math/median/median.go @@ -2,24 +2,19 @@ package median import ( "math/big" - "sort" - - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/skip-mev/slinky/oracle/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" + "github.com/skip-mev/slinky/pkg/math" ) -func ComputeMedianWithContext(_ sdk.Context) types.PriceAggregationFn { - return ComputeMedian() -} - // ComputeMedian inputs the aggregated prices from all providers and computes // the median price for each asset. +// +// NOTE: This function should only be used for testing purposes. func ComputeMedian() types.PriceAggregationFn { - return func(providers types.AggregatedProviderPrices) types.TickerPrices { + return func(providers types.AggregatedProviderPrices) types.AggregatorPrices { // Aggregate prices across all providers for each asset. - pricesByAsset := make(map[mmtypes.Ticker][]*big.Int) + pricesByAsset := make(map[string][]*big.Float) for _, providerPrices := range providers { for cp, price := range providerPrices { // Only include prices that are not nil @@ -29,58 +24,23 @@ func ComputeMedian() types.PriceAggregationFn { // Initialize the asset array if it doesn't exist if _, ok := pricesByAsset[cp]; !ok { - pricesByAsset[cp] = make([]*big.Int, 0) + pricesByAsset[cp] = make([]*big.Float, 0) } pricesByAsset[cp] = append(pricesByAsset[cp], price) } } - medianPrices := make(types.TickerPrices, len(pricesByAsset)) // Iterate through all assets and compute the median price + medianPrices := make(types.AggregatorPrices, len(pricesByAsset)) for cp, prices := range pricesByAsset { if len(prices) == 0 { continue } - medianPrices[cp] = CalculateMedian(prices) + medianPrices[cp] = math.CalculateMedian(prices) } return medianPrices } } - -// SortBigInts is a stable slices sort for an array of big.Ints. -func SortBigInts(values []*big.Int) { - // Sort the values. - sort.SliceStable(values, func(i, j int) bool { - switch values[i].Cmp(values[j]) { - case -1: - return true - case 1: - return false - default: - return true - } - }) -} - -// CalculateMedian calculates the median from a list of big.Ints. Returns an -// average if the number of values is even. -func CalculateMedian(values []*big.Int) *big.Int { - SortBigInts(values) - - middleIndex := len(values) / 2 - - // Calculate the median. - numValues := len(values) - var median *big.Int - if numValues%2 == 0 { // even - median = new(big.Int).Add(values[middleIndex-1], values[middleIndex]) - median = median.Div(median, new(big.Int).SetUint64(2)) - } else { // odd - median = values[middleIndex] - } - - return median -} diff --git a/pkg/math/median/median_test.go b/pkg/math/median/median_test.go index 0685357e2..18a3456a9 100644 --- a/pkg/math/median/median_test.go +++ b/pkg/math/median/median_test.go @@ -9,87 +9,86 @@ import ( "github.com/skip-mev/slinky/oracle/constants" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/pkg/math/median" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) func TestComputeMedian(t *testing.T) { testCases := []struct { name string providerPrices types.AggregatedProviderPrices - expectedPrices map[mmtypes.Ticker]*big.Int + expectedPrices map[string]*big.Float }{ { "empty provider prices", types.AggregatedProviderPrices{}, - map[mmtypes.Ticker]*big.Int{}, + map[string]*big.Float{}, }, { "single provider price", types.AggregatedProviderPrices{ "provider1": { - constants.BITCOIN_USD: big.NewInt(100), - constants.ETHEREUM_USD: big.NewInt(200), + constants.BITCOIN_USD.String(): big.NewFloat(100), + constants.ETHEREUM_USD.String(): big.NewFloat(200), }, }, - map[mmtypes.Ticker]*big.Int{ - constants.BITCOIN_USD: big.NewInt(100), - constants.ETHEREUM_USD: big.NewInt(200), + map[string]*big.Float{ + constants.BITCOIN_USD.String(): big.NewFloat(100), + constants.ETHEREUM_USD.String(): big.NewFloat(200), }, }, { "multiple provider prices", types.AggregatedProviderPrices{ "provider1": { - constants.BITCOIN_USD: big.NewInt(100), - constants.ETHEREUM_USD: big.NewInt(200), + constants.BITCOIN_USD.String(): big.NewFloat(100), + constants.ETHEREUM_USD.String(): big.NewFloat(200), }, "provider2": { - constants.BITCOIN_USD: big.NewInt(200), - constants.ETHEREUM_USD: big.NewInt(300), + constants.BITCOIN_USD.String(): big.NewFloat(200), + constants.ETHEREUM_USD.String(): big.NewFloat(300), }, }, - map[mmtypes.Ticker]*big.Int{ - constants.BITCOIN_USD: big.NewInt(150), - constants.ETHEREUM_USD: big.NewInt(250), + map[string]*big.Float{ + constants.BITCOIN_USD.String(): big.NewFloat(150), + constants.ETHEREUM_USD.String(): big.NewFloat(250), }, }, { "multiple provider prices with different assets", types.AggregatedProviderPrices{ "provider1": { - constants.BITCOIN_USD: big.NewInt(100), - constants.ETHEREUM_USD: big.NewInt(200), + constants.BITCOIN_USD.String(): big.NewFloat(100), + constants.ETHEREUM_USD.String(): big.NewFloat(200), }, "provider2": { - constants.BITCOIN_USD: big.NewInt(200), - constants.ETHEREUM_USD: big.NewInt(300), - constants.USDT_USD: nil, // should be ignored + constants.BITCOIN_USD.String(): big.NewFloat(200), + constants.ETHEREUM_USD.String(): big.NewFloat(300), + constants.USDT_USD.String(): nil, // should be ignored }, }, - map[mmtypes.Ticker]*big.Int{ - constants.BITCOIN_USD: big.NewInt(150), - constants.ETHEREUM_USD: big.NewInt(250), + map[string]*big.Float{ + constants.BITCOIN_USD.String(): big.NewFloat(150), + constants.ETHEREUM_USD.String(): big.NewFloat(250), }, }, { "odd number of provider prices", types.AggregatedProviderPrices{ "provider1": { - constants.BITCOIN_USD: big.NewInt(100), - constants.ETHEREUM_USD: big.NewInt(200), + constants.BITCOIN_USD.String(): big.NewFloat(100), + constants.ETHEREUM_USD.String(): big.NewFloat(200), }, "provider2": { - constants.BITCOIN_USD: big.NewInt(200), - constants.ETHEREUM_USD: big.NewInt(300), + constants.BITCOIN_USD.String(): big.NewFloat(200), + constants.ETHEREUM_USD.String(): big.NewFloat(300), }, "provider3": { - constants.BITCOIN_USD: big.NewInt(300), - constants.ETHEREUM_USD: big.NewInt(400), + constants.BITCOIN_USD.String(): big.NewFloat(300), + constants.ETHEREUM_USD.String(): big.NewFloat(400), }, }, - map[mmtypes.Ticker]*big.Int{ - constants.BITCOIN_USD: big.NewInt(200), - constants.ETHEREUM_USD: big.NewInt(300), + map[string]*big.Float{ + constants.BITCOIN_USD.String(): big.NewFloat(200), + constants.ETHEREUM_USD.String(): big.NewFloat(300), }, }, } @@ -108,66 +107,3 @@ func TestComputeMedian(t *testing.T) { }) } } - -func TestSortBigInts(t *testing.T) { - testCases := []struct { - name string - values []*big.Int - expected []*big.Int - }{ - { - name: "do nothing for nil slice", - }, - { - name: "sort a slice", - values: []*big.Int{ - big.NewInt(10), - big.NewInt(-2), - big.NewInt(100), - big.NewInt(0), - big.NewInt(0), - }, - expected: []*big.Int{ - big.NewInt(-2), - big.NewInt(0), - big.NewInt(0), - big.NewInt(10), - big.NewInt(100), - }, - }, - { - name: "do nothing for same values", - values: []*big.Int{ - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(-2), - big.NewInt(100), - big.NewInt(0), - big.NewInt(0), - }, - expected: []*big.Int{ - big.NewInt(-2), - big.NewInt(0), - big.NewInt(0), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(10), - big.NewInt(100), - }, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - median.SortBigInts(tc.values) - require.Equal(t, tc.expected, tc.values) - }) - } -} diff --git a/pkg/math/oracle/aggregator.go b/pkg/math/oracle/aggregator.go new file mode 100644 index 000000000..0e2709568 --- /dev/null +++ b/pkg/math/oracle/aggregator.go @@ -0,0 +1,79 @@ +package oracle + +import ( + "maps" + + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/skip-mev/slinky/oracle/types" +) + +// GetProviderData returns the provider data the aggregator has. +func (m *MedianAggregator) GetProviderData() types.AggregatedProviderPrices { + m.mtx.Lock() + defer m.mtx.Unlock() + + cpy := make(types.AggregatedProviderPrices) + maps.Copy(cpy, m.providerPrices) + + return cpy +} + +// GetDataByProvider returns the data currently stored for a given provider. +func (m *MedianAggregator) GetDataByProvider(provider string) types.AggregatorPrices { + m.mtx.Lock() + defer m.mtx.Unlock() + + cpy := make(types.AggregatorPrices) + maps.Copy(cpy, m.providerPrices[provider]) + + return cpy +} + +// SetProviderData updates the data aggregator with the given provider and data. +func (m *MedianAggregator) SetProviderData(provider string, data types.AggregatorPrices) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if data == nil { + data = make(types.AggregatorPrices) + } + + m.providerPrices[provider] = data +} + +// ResetProviderData resets the data aggregator for all providers. +func (m *MedianAggregator) ResetProviderData() { + m.mtx.Lock() + defer m.mtx.Unlock() + + m.providerPrices = make(types.AggregatedProviderPrices) +} + +// GetAggregatedData returns the aggregated data the aggregator has. +func (m *MedianAggregator) GetAggregatedData() types.AggregatorPrices { + m.mtx.Lock() + defer m.mtx.Unlock() + + cpy := make(types.AggregatorPrices) + maps.Copy(cpy, m.scaledPrices) + + return cpy +} + +// SetAggregatedData updates the data aggregator with the given aggregated data. +func (m *MedianAggregator) SetAggregatedData(data types.AggregatorPrices) { + m.mtx.Lock() + defer m.mtx.Unlock() + + if data == nil { + data = make(types.AggregatorPrices) + } + + m.scaledPrices = data +} + +// AggregateDataFromContext is a no-op for the median aggregator. +func (m *MedianAggregator) AggregateDataFromContext(_ sdk.Context) { + // no-op +} diff --git a/pkg/math/oracle/helper_test.go b/pkg/math/oracle/helper_test.go index 2f5fb662c..2f87a793d 100644 --- a/pkg/math/oracle/helper_test.go +++ b/pkg/math/oracle/helper_test.go @@ -1,12 +1,10 @@ package oracle_test import ( - "math/big" - "go.uber.org/zap" "github.com/skip-mev/slinky/oracle/constants" - "github.com/skip-mev/slinky/pkg/math/oracle" + pkgtypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/providers/apis/binance" "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/websockets/kucoin" @@ -14,39 +12,30 @@ import ( ) var ( - // acceptableDelta is the acceptable difference between the expected and actual price. - // In this case, we use a delta of 1e-8. This means we will accept any price that is - // within 1e-8 of the expected price. - acceptableDelta = 1e-8 - // Create some custom tickers for testing. BTC_USD = mmtypes.Ticker{ - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Decimals: constants.BITCOIN_USD.Decimals, + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, MinProviderCount: 3, } - BTC_USDT = constants.BITCOIN_USDT ETH_USD = mmtypes.Ticker{ - CurrencyPair: constants.ETHEREUM_USD.CurrencyPair, - Decimals: constants.ETHEREUM_USD.Decimals, + CurrencyPair: constants.ETHEREUM_USD, + Decimals: 11, MinProviderCount: 3, } - ETH_USDT = constants.ETHEREUM_USDT USDT_USD = mmtypes.Ticker{ - CurrencyPair: constants.USDT_USD.CurrencyPair, - Decimals: constants.USDT_USD.Decimals, + CurrencyPair: constants.USDT_USD, + Decimals: 6, MinProviderCount: 2, } - USDC_USDT = constants.USDC_USDT PEPE_USD = mmtypes.Ticker{ - CurrencyPair: constants.PEPE_USD.CurrencyPair, - Decimals: constants.PEPE_USD.Decimals, + CurrencyPair: constants.PEPE_USD, + Decimals: 18, MinProviderCount: 1, } - PEPE_USDT = constants.PEPE_USDT logger = zap.NewExample() @@ -54,228 +43,97 @@ var ( // In particular all of the paths correspond to the desired "index prices" i.e. the // prices we actually want to resolve to. marketmap = mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - BTC_USD.String(): BTC_USD, - BTC_USDT.String(): BTC_USDT, - USDT_USD.String(): USDT_USD, - USDC_USDT.String(): USDC_USDT, - ETH_USD.String(): ETH_USD, - ETH_USDT.String(): ETH_USDT, - PEPE_USDT.String(): PEPE_USDT, - PEPE_USD.String(): PEPE_USD, - }, - Providers: map[string]mmtypes.Providers{ + Markets: map[string]mmtypes.Market{ BTC_USD.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.BITCOIN_USD], - }, - }, - BTC_USDT.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.BITCOIN_USDT], - binance.DefaultNonUSMarketConfig[constants.BITCOIN_USDT], - kucoin.DefaultMarketConfig[constants.BITCOIN_USDT], - }, - }, - ETH_USD.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.ETHEREUM_USD], - }, - }, - ETH_USDT.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.ETHEREUM_USDT], - binance.DefaultNonUSMarketConfig[constants.ETHEREUM_USDT], - }, - }, - USDT_USD.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.USDT_USD], - binance.DefaultNonUSMarketConfig[constants.USDT_USD], - }, - }, - USDC_USDT.String(): { - Providers: []mmtypes.ProviderConfig{ - coinbase.DefaultMarketConfig[constants.USDC_USDT], - }, - }, - PEPE_USDT.String(): { - Providers: []mmtypes.ProviderConfig{ - binance.DefaultNonUSMarketConfig[constants.PEPE_USDT], - }, - }, - }, - Paths: map[string]mmtypes.Paths{ - BTC_USD.String(): { - Paths: []mmtypes.Path{ + Ticker: BTC_USD, + ProviderConfigs: []mmtypes.ProviderConfig{ { - // COINBASE BTC/USD = BTC/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Invert: false, - Provider: coinbase.Name, - }, - }, + Name: coinbase.Name, + OffChainTicker: "BTC-USD", }, { - // COINBASE BTC/USDT * INDEX USDT/USD = BTC/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Invert: false, - Provider: coinbase.Name, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: mmtypes.IndexPrice, - }, + Name: coinbase.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, { - // BINANCE BTC/USDT * INDEX USDT/USD = BTC/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Invert: false, - Provider: binance.Name, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: mmtypes.IndexPrice, - }, + Name: binance.Name, + OffChainTicker: "BTCUSDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, }, ETH_USD.String(): { - Paths: []mmtypes.Path{ + Ticker: ETH_USD, + ProviderConfigs: []mmtypes.ProviderConfig{ { - // COINBASE ETH/USD = ETH/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: ETH_USD.CurrencyPair, - Invert: false, - Provider: coinbase.Name, - }, - }, + Name: coinbase.Name, + OffChainTicker: "ETH-USD", }, { - // COINBASE ETH/USDT * INDEX USDT/USD = ETH/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: ETH_USDT.CurrencyPair, - Invert: false, - Provider: coinbase.Name, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: mmtypes.IndexPrice, - }, + Name: coinbase.Name, + OffChainTicker: "ETH-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, { - // BINANCE ETH/USDT * INDEX USDT/USD = ETH/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: ETH_USDT.CurrencyPair, - Invert: false, - Provider: binance.Name, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: mmtypes.IndexPrice, - }, + Name: binance.Name, + OffChainTicker: "ETHUSDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, }, USDT_USD.String(): { - Paths: []mmtypes.Path{ + Ticker: USDT_USD, + ProviderConfigs: []mmtypes.ProviderConfig{ { - // COINBASE USDT/USD = USDT/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: coinbase.Name, - }, - }, + Name: coinbase.Name, + OffChainTicker: "USDT-USD", }, { - // COINBASE USDC/USDT ^ -1 = USDT/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: USDC_USDT.CurrencyPair, - Invert: true, - Provider: coinbase.Name, - }, - }, + Name: coinbase.Name, + OffChainTicker: "USDC-USDT", + Invert: true, }, { - // BINANCE USDT/USD = USDT/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: binance.Name, - }, - }, + Name: binance.Name, + OffChainTicker: "USDTUSD", }, - { - // Kucoin BTC/USDT ^-1 * INDEX BTC/USD = USDT/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Invert: true, - Provider: kucoin.Name, - }, - { - CurrencyPair: BTC_USD.CurrencyPair, - Invert: false, - Provider: mmtypes.IndexPrice, - }, + Name: kucoin.Name, + OffChainTicker: "BTC-USDT", + Invert: true, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", }, }, }, }, PEPE_USD.String(): { - Paths: []mmtypes.Path{ + Ticker: PEPE_USD, + ProviderConfigs: []mmtypes.ProviderConfig{ { - // BINANCE PEPE/USDT * INDEX USDT/USD = PEPE/USD - Operations: []mmtypes.Operation{ - { - CurrencyPair: PEPE_USDT.CurrencyPair, - Invert: false, - Provider: binance.Name, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Invert: false, - Provider: mmtypes.IndexPrice, - }, + OffChainTicker: "PEPEUSDT", + Name: binance.Name, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, }, }, - AggregationType: mmtypes.AggregationType_INDEX_PRICE_AGGREGATION, } ) - -// createPrice creates a price with the given number of decimals. -func createPrice(price float64, decimals uint64) *big.Int { - // Convert the price to a big float so we can perform the multiplication. - floatPrice := big.NewFloat(price) - - // Scale the price and convert it to a big.Int. - one := oracle.ScaledOne(decimals) - scaledPrice := new(big.Float).Mul(floatPrice, new(big.Float).SetInt(one)) - intPrice, _ := scaledPrice.Int(nil) - return intPrice -} diff --git a/pkg/math/oracle/math.go b/pkg/math/oracle/math.go deleted file mode 100644 index 93f60f52f..000000000 --- a/pkg/math/oracle/math.go +++ /dev/null @@ -1,74 +0,0 @@ -package oracle - -import ( - "fmt" - "math/big" -) - -// ScaledDecimals is the standard number of decimal places each price will be converted to -// during the conversion process. -const ScaledDecimals = 36 - -// ScaleUpCurrencyPairPrice scales a price up to the standard number of decimals by performing the -// following operation: -// 1. price * 10^(ScaledDecimals - decimals) -// 2. Convert the result to a big.Int -// -// NOTE: This function should only be used on prices that have not already been scaled to the -// standard number of decimals. We scale the price to the standard number of decimals for ease -// of comparison. -func ScaleUpCurrencyPairPrice(decimals uint64, price *big.Int) (*big.Int, error) { - if decimals > ScaledDecimals { - return nil, fmt.Errorf("cannot scale up price with more decimals than the standard: max=%d, current=%d", ScaledDecimals, decimals) - } - - diff := ScaledDecimals - decimals - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(int64(diff)), nil) - return new(big.Int).Mul(price, exp), nil -} - -// ScaleDownCurrencyPairPrice scales a price down to the standard number of decimals by performing the -// following operation: -// 1. price / 10^(ScaledDecimals - decimals) -// 2. Convert the result to a big.Int -// -// NOTE: This function should only be used on prices that have already been scaled to the standard -// number of decimals. The output of this returns the price to its expected number of decimals. -func ScaleDownCurrencyPairPrice(decimals uint64, price *big.Int) (*big.Int, error) { - if decimals > ScaledDecimals { - return nil, fmt.Errorf("cannot scale down price with more decimals than the standard: max=%d, current=%d", ScaledDecimals, decimals) - } - - diff := ScaledDecimals - decimals - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(int64(diff)), nil) - return new(big.Int).Div(price, exp), nil -} - -// InvertCurrencyPairPrice inverts a price by performing the following operation: -// 1. 1 / price -// 2. Scale the result by the number of decimals -// 3. Convert the result to a big.Int -// -// NOTE: This function should only be used on prices that have already been scaled -// to the standard number of decimals. -func InvertCurrencyPairPrice(price *big.Int, decimals uint64) *big.Int { - one := ScaledOne(decimals) - - // Convert the price to a big.Float so we can perform the division - // and then convert the result back to a big.Int This operation is - // the equivalent of 1 / price. - ratio := new(big.Float).Quo(new(big.Float).SetInt(one), new(big.Float).SetInt(price)) - - // Scale the ratio by the number of decimals. - scaledRatio := new(big.Float).Mul(ratio, new(big.Float).SetInt(one)) - - // Convert the scaled ratio back to a big.Int - inverted, _ := scaledRatio.Int(nil) - return inverted -} - -// ScaledOne returns a big.Int that represents the number 1 scaled to the standard -// number of decimals. -func ScaledOne(decimals uint64) *big.Int { - return big.NewInt(1).Exp(big.NewInt(10), big.NewInt(int64(decimals)), nil) -} diff --git a/pkg/math/oracle/math_test.go b/pkg/math/oracle/math_test.go deleted file mode 100644 index ca4e758fd..000000000 --- a/pkg/math/oracle/math_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package oracle_test - -import ( - "math/big" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/pkg/math/oracle" -) - -func TestInvertCurrencyPairPrice(t *testing.T) { - t.Run("can invert a price of 1", func(t *testing.T) { - one := oracle.ScaledOne(oracle.ScaledDecimals) - inverted := oracle.InvertCurrencyPairPrice(one, oracle.ScaledDecimals) - require.Equal(t, one, inverted) - }) - - t.Run("can invert a price of 2000", func(t *testing.T) { - price := big.NewInt(2000) - scaledPrice := new(big.Int).Mul(price, oracle.ScaledOne(oracle.ScaledDecimals)) - inverted := oracle.InvertCurrencyPairPrice(scaledPrice, oracle.ScaledDecimals) - - expectedExp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals-4), nil) - expectedPrice := big.NewInt(5) - expectedScaledPrice := new(big.Int).Mul(expectedPrice, expectedExp) - require.Equal(t, expectedScaledPrice, inverted) - }) - - t.Run("can invert a price of 2", func(t *testing.T) { - price := big.NewInt(2) - scaledPrice := new(big.Int).Mul(price, oracle.ScaledOne(oracle.ScaledDecimals)) - inverted := oracle.InvertCurrencyPairPrice(scaledPrice, oracle.ScaledDecimals) - - expectedExp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals-1), nil) - expectedPrice := big.NewInt(5) - expectedScaledPrice := new(big.Int).Mul(expectedPrice, expectedExp) - require.Equal(t, expectedScaledPrice, inverted) - }) - - t.Run("can invert a price of 0.5", func(t *testing.T) { - price := big.NewInt(5) - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals-1), nil) - scaledPrice := new(big.Int).Mul(price, exp) - inverted := oracle.InvertCurrencyPairPrice(scaledPrice, oracle.ScaledDecimals) - - expectedExp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals), nil) - expectedPrice := big.NewInt(2) - expectedScaledPrice := new(big.Int).Mul(expectedPrice, expectedExp) - require.Equal(t, expectedScaledPrice, inverted) - }) -} - -func TestScaleUpCurrencyPairPrice(t *testing.T) { - t.Run("can scale up a price of 1", func(t *testing.T) { - price := big.NewInt(1) - scaledPrice, err := oracle.ScaleUpCurrencyPairPrice(0, price) - require.NoError(t, err) - - one := oracle.ScaledOne(oracle.ScaledDecimals) - require.Equal(t, one, scaledPrice) - }) - - t.Run("can scale up a price of 2000", func(t *testing.T) { - price := big.NewInt(2000) - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals-8), nil) - expectedPrice := new(big.Int).Mul(price, exp) - - scaledPrice, err := oracle.ScaleUpCurrencyPairPrice(8, price) - require.NoError(t, err) - require.Equal(t, expectedPrice, scaledPrice) - }) - - t.Run("errors when scaling up a price with more decimals than the standard", func(t *testing.T) { - price := big.NewInt(2000) - _, err := oracle.ScaleUpCurrencyPairPrice(oracle.ScaledDecimals+1, price) - require.Error(t, err) - }) - - t.Run("equal number of decimal points", func(t *testing.T) { - price := big.NewInt(2000) - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals), nil) - expectedPrice := new(big.Int).Mul(price, exp) - - scaledPrice, err := oracle.ScaleUpCurrencyPairPrice(oracle.ScaledDecimals, expectedPrice) - require.NoError(t, err) - require.Equal(t, expectedPrice, scaledPrice) - }) -} - -func TestScaleDownCurrencyPairPrice(t *testing.T) { - t.Run("can scale down a price of 1", func(t *testing.T) { - one := oracle.ScaledOne(oracle.ScaledDecimals) - scaledPrice, err := oracle.ScaleDownCurrencyPairPrice(0, one) - require.NoError(t, err) - - require.Equal(t, big.NewInt(1), scaledPrice) - }) - - t.Run("can scale down a price of 2000", func(t *testing.T) { - price := big.NewInt(2000) - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(8), nil) - price = new(big.Int).Mul(price, exp) - - scaledPrice, err := oracle.ScaleUpCurrencyPairPrice(8, price) - require.NoError(t, err) - - unscaledPrice, err := oracle.ScaleDownCurrencyPairPrice(8, scaledPrice) - require.NoError(t, err) - require.Equal(t, price, unscaledPrice) - }) - - t.Run("errors when scaling down a price with more decimals than the standard", func(t *testing.T) { - price := big.NewInt(2000) - _, err := oracle.ScaleDownCurrencyPairPrice(oracle.ScaledDecimals+1, price) - require.Error(t, err) - }) - - t.Run("equal number of decimal points", func(t *testing.T) { - price := big.NewInt(2000) - exp := big.NewInt(10).Exp(big.NewInt(10), big.NewInt(oracle.ScaledDecimals), nil) - price = new(big.Int).Mul(price, exp) - - scaledPrice, err := oracle.ScaleDownCurrencyPairPrice(oracle.ScaledDecimals, price) - require.NoError(t, err) - require.Equal(t, price, scaledPrice) - }) -} diff --git a/pkg/math/oracle/median.go b/pkg/math/oracle/median.go index b8a6485dc..75f078225 100644 --- a/pkg/math/oracle/median.go +++ b/pkg/math/oracle/median.go @@ -3,25 +3,36 @@ package oracle import ( "fmt" "math/big" + "sync" "go.uber.org/zap" - "github.com/skip-mev/slinky/aggregator" oraclemetrics "github.com/skip-mev/slinky/oracle/metrics" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math/median" + "github.com/skip-mev/slinky/pkg/math" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) +var _ types.PriceAggregator = &MedianAggregator{} + // MedianAggregator is an aggregator that calculates the median price for each ticker, // resolved from a predefined set of conversion markets. A conversion market is a set of // markets that can be used to convert the prices of a set of tickers to a common ticker. // These are defined in the market map configuration. type MedianAggregator struct { - *aggregator.DataAggregator[string, types.TickerPrices] + mtx sync.Mutex logger *zap.Logger cfg mmtypes.MarketMap metrics oraclemetrics.Metrics + + // indexPrices cache the median prices for each ticker. These are unscaled prices. + indexPrices types.AggregatorPrices + // scaledPrices cache the scaled prices for each ticker. These are the prices that can be + // consumed by consumers. + scaledPrices types.AggregatorPrices + // providerPrices cache the unscaled prices for each provider. These are indexed by + // provider -> offChainTicker -> price. + providerPrices types.AggregatedProviderPrices } // NewMedianAggregator returns a new Median aggregator. @@ -47,7 +58,9 @@ func NewMedianAggregator( logger: logger, cfg: cfg, metrics: metrics, - DataAggregator: aggregator.NewDataAggregator[string, types.TickerPrices](), + indexPrices: make(types.AggregatorPrices), + scaledPrices: make(types.AggregatorPrices), + providerPrices: make(types.AggregatedProviderPrices), }, nil } @@ -61,32 +74,24 @@ func NewMedianAggregator( // // The index price cache contains the previously calculated median prices. func (m *MedianAggregator) AggregateData() { - cfg := m.GetMarketMap() - updatedPrices := make(types.TickerPrices) - for ticker, paths := range cfg.Paths { - target, ok := cfg.Tickers[ticker] - if !ok { - m.logger.Error( - "failed to get ticker; skipping aggregation", - zap.String("ticker", ticker), - ) + m.mtx.Lock() + defer m.mtx.Unlock() - continue - } + indexPrices := make(types.AggregatorPrices) + scaledPrices := make(types.AggregatorPrices) + for ticker, market := range m.cfg.Markets { // Get the converted prices for set of convertable markets. // ex. BTC/USDT * Index USDT/USD = BTC/USD // BTC/USDC * Index USDC/USD = BTC/USD - convertedPrices := m.CalculateConvertedPrices( - target, - paths, - ) + target := market.Ticker + convertedPrices := m.CalculateConvertedPrices(market) // We need to have at least the minimum number of providers to calculate the median. if len(convertedPrices) < int(target.MinProviderCount) { m.logger.Error( "insufficient amount of converted prices", - zap.String("ticker", ticker), + zap.String("target_ticker", ticker), zap.Int("num_converted_prices", len(convertedPrices)), zap.Any("converted_prices", convertedPrices), zap.Int("min_provider_count", int(target.MinProviderCount)), @@ -97,80 +102,75 @@ func (m *MedianAggregator) AggregateData() { // Take the median of the converted prices. This takes the average of the middle two // prices if the number of prices is even. - price := median.CalculateMedian(convertedPrices) - updatedPrices[target] = price + price := math.CalculateMedian(convertedPrices) + indexPrices[target.String()] = new(big.Float).Copy(price) + + // Scale the price to the target ticker's decimals. + scaledPrices[target.String()] = math.ScaleBigFloat(new(big.Float).Copy(price), target.Decimals) + m.logger.Info( "calculated median price", - zap.String("ticker", ticker), - zap.String("price", price.String()), + zap.String("target_ticker", ticker), + + zap.String("unscaled_price", indexPrices[target.String()].String()), + zap.String("scaled_price", scaledPrices[target.String()].String()), zap.Any("converted_prices", convertedPrices), ) - m.metrics.AddTickerTick(target.String()) - floatPrice, _ := price.Float64() + m.metrics.AddTickerTick(target.String()) m.metrics.UpdateAggregatePrice(target.String(), target.GetDecimals(), floatPrice) } // Update the aggregated data. These prices are going to be used as the index prices the // next time we calculate prices. - m.DataAggregator.SetAggregatedData(updatedPrices) - m.logger.Info("calculated median prices for price feeds", zap.Int("num_prices", len(updatedPrices))) + m.logger.Info("calculated median prices for price feeds", zap.Int("num_prices", len(indexPrices))) + m.indexPrices = indexPrices + m.scaledPrices = scaledPrices } // CalculateConvertedPrices calculates the converted prices for a given set of paths and target ticker. // The prices utilized are the prices most recently seen by the providers. Each price is within a // MaxPriceAge window so is safe to use. func (m *MedianAggregator) CalculateConvertedPrices( - target mmtypes.Ticker, - paths mmtypes.Paths, -) []*big.Int { - m.logger.Debug("calculating converted prices", zap.String("ticker", target.String())) - if len(paths.Paths) == 0 { + market mmtypes.Market, +) []*big.Float { + m.logger.Debug("calculating converted prices", zap.String("ticker", market.Ticker.String())) + if len(market.ProviderConfigs) == 0 { m.logger.Error( "no conversion paths", - zap.String("ticker", target.String()), + zap.String("target_ticker", market.Ticker.String()), ) return nil } - convertedPrices := make([]*big.Int, 0, len(paths.Paths)) - for _, path := range paths.Paths { - if len(path.Operations) == 0 { - m.logger.Error( - "no operations", - zap.String("ticker", target.String()), - ) - - continue - } - + convertedPrices := make([]*big.Float, 0, len(market.ProviderConfigs)) + for _, cfg := range market.ProviderConfigs { // Calculate the converted price. - provider := path.Operations[0].Provider - adjustedPrice, err := m.CalculateAdjustedPrice(target, path.Operations) + adjustedPrice, err := m.CalculateAdjustedPrice(cfg) if err != nil { m.logger.Debug( "failed to calculate converted price", zap.Error(err), - zap.String("ticker", target.String()), - zap.Any("conversions", path), + zap.String("target_ticker", market.Ticker.String()), + zap.Any("provider", cfg.Name), ) - m.metrics.AddProviderTick(provider, target.String(), false) + m.metrics.AddProviderTick(cfg.Name, market.Ticker.String(), false) continue } convertedPrices = append(convertedPrices, adjustedPrice) m.logger.Debug( "calculated converted price", - zap.String("ticker", target.String()), + zap.String("target_ticker", market.Ticker.String()), zap.String("price", adjustedPrice.String()), - zap.Any("conversions", path.Operations), + zap.Any("provider", cfg.Name), ) - m.metrics.AddProviderTick(provider, target.String(), true) + m.metrics.AddProviderTick(cfg.Name, market.Ticker.String(), true) floatPrice, _ := adjustedPrice.Float64() - m.metrics.UpdatePrice(provider, target.String(), target.GetDecimals(), floatPrice) + m.metrics.UpdatePrice(cfg.Name, market.Ticker.String(), market.Ticker.GetDecimals(), floatPrice) } return convertedPrices @@ -187,39 +187,22 @@ func (m *MedianAggregator) CalculateConvertedPrices( // to adjust the price by the index price of the asset. If the index price is not available, we // return an error. func (m *MedianAggregator) CalculateAdjustedPrice( - target mmtypes.Ticker, - operations []mmtypes.Operation, -) (*big.Int, error) { - // Sanity check the number of operations. This should be [1, 2] operations. - if len(operations) == 0 { - return nil, fmt.Errorf("no operations") - } else if len(operations) > mmtypes.MaxConversionOperations { - return nil, fmt.Errorf("too many operations: %d", len(operations)) - } - - price, err := m.GetProviderPrice(operations[0]) + cfg mmtypes.ProviderConfig, +) (*big.Float, error) { + price, err := m.GetProviderPrice(cfg) if err != nil { return nil, err } - // If we have a single operation, then we can simply return the price. This implies that - // we have a direct conversion from the base ticker to the target ticker. - if len(operations) == 1 { - return ScaleDownCurrencyPairPrice(target.Decimals, price) - } - - // If we have more than one operation, then can only adjust the price using the index. - if operations[1].Provider != mmtypes.IndexPrice { - return nil, fmt.Errorf("expected index price but got %s", operations[1].Provider) + if cfg.NormalizeByPair == nil { + return price, nil } - adjustableByMarketPrice, err := m.GetProviderPrice(operations[1]) + normalizeByIndexPrice, err := m.GetIndexPrice(*cfg.NormalizeByPair) if err != nil { return nil, err } // Make sure that the price is adjusted by the market price. - adjustedPrice := big.NewInt(0).Mul(price, adjustableByMarketPrice) - adjustedPrice = adjustedPrice.Div(adjustedPrice, ScaledOne(ScaledDecimals)) - return ScaleDownCurrencyPairPrice(target.Decimals, adjustedPrice) + return new(big.Float).Mul(price, normalizeByIndexPrice), nil } diff --git a/pkg/math/oracle/median_test.go b/pkg/math/oracle/median_test.go index 1e6bd2eda..9c0eaff1b 100644 --- a/pkg/math/oracle/median_test.go +++ b/pkg/math/oracle/median_test.go @@ -6,10 +6,11 @@ import ( "github.com/stretchr/testify/require" + "github.com/skip-mev/slinky/oracle/constants" "github.com/skip-mev/slinky/oracle/metrics" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" "github.com/skip-mev/slinky/pkg/math/oracle" + pkgtypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/providers/apis/binance" "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/websockets/kucoin" @@ -19,118 +20,118 @@ import ( func TestAggregateData(t *testing.T) { testCases := []struct { name string - malleate func(aggregator types.PriceAggregator) - expectedPrices types.TickerPrices + malleate func(aggregator *oracle.MedianAggregator) + expectedPrices types.AggregatorPrices }{ { name: "no data", - malleate: func(types.PriceAggregator) {}, - expectedPrices: types.TickerPrices{}, + malleate: func(*oracle.MedianAggregator) {}, + expectedPrices: types.AggregatorPrices{}, }, { name: "coinbase direct feed for BTC/USD - fail since it does not have enough providers", - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) }, - expectedPrices: types.TickerPrices{}, + expectedPrices: types.AggregatorPrices{}, }, { name: "coinbase direct feed, coinbase adjusted feed, binance adjusted feed for BTC/USD - fail since index price does not exist", - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(70_000), + "BTC-USDT": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - BTC_USDT: createPrice(69_000, BTC_USDT.Decimals), + prices = types.AggregatorPrices{ + "BTCUSDT": big.NewFloat(69_000), } aggregator.SetProviderData(binance.Name, prices) }, - expectedPrices: types.TickerPrices{}, + expectedPrices: types.AggregatorPrices{}, }, { name: "coinbase direct feed, coinbase adjusted feed, binance adjusted feed for BTC/USD with index prices - success", - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(70_000), + "BTC-USDT": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - BTC_USDT: createPrice(69_000, BTC_USDT.Decimals), + prices = types.AggregatorPrices{ + "BTCUSDT": big.NewFloat(69_000), } aggregator.SetProviderData(binance.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.1), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrices: types.TickerPrices{ - BTC_USD: createPrice(75_900, BTC_USD.Decimals), // median of 70_000, 75_900, 77_000 + expectedPrices: types.AggregatorPrices{ + BTC_USD.String(): big.NewFloat(75_900), // median of 70_000, 75_900, 77_000 }, }, { name: "coinbase USDT direct, coinbase USDC/USDT inverted, binance direct feeds for USDT/USD - success", - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), - USDC_USDT: createPrice(1.1, USDC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "USDT-USD": big.NewFloat(1.1), + "USDC-USDT": big.NewFloat(1.1), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - USDT_USD: createPrice(1.2, USDT_USD.Decimals), + prices = types.AggregatorPrices{ + "USDTUSD": big.NewFloat(1.2), } aggregator.SetProviderData(binance.Name, prices) }, - expectedPrices: types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), // median of 0.90909, 1, 1.2 + expectedPrices: types.AggregatorPrices{ + USDT_USD.String(): big.NewFloat(1.1), // median of 0.90909, 1.1, 1.2 }, }, { name: "coinbase USDT direct, binance USDT/USD direct feeds for USDT/USD - success (average of two prices)", - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "USDT-USD": big.NewFloat(1.1), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - USDT_USD: createPrice(1.2, USDT_USD.Decimals), + prices = types.AggregatorPrices{ + "USDTUSD": big.NewFloat(1.2), } aggregator.SetProviderData(binance.Name, prices) }, - expectedPrices: types.TickerPrices{ - USDT_USD: createPrice(1.15, USDT_USD.Decimals), // average of 1.1, 1.2 + expectedPrices: types.AggregatorPrices{ + USDT_USD.String(): big.NewFloat(1.15), // average of 1.1, 1.2 }, }, { name: "coinbase USDT direct, kucoin BTC/USDT inverted, index BTC/USD direct feeds for USDT/USD - success", - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - USDT_USD: createPrice(1.0, USDT_USD.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "USDT-USD": big.NewFloat(1.0), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + prices = types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(70_000), } aggregator.SetProviderData(kucoin.Name, prices) - indexPrices := types.TickerPrices{ - BTC_USD: createPrice(77_000, BTC_USD.Decimals), + indexPrices := types.AggregatorPrices{ + BTC_USD.String(): big.NewFloat(77_000), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrices: types.TickerPrices{ - USDT_USD: createPrice(1.05, USDT_USD.Decimals), // average of 1.1, 1.0 + expectedPrices: types.AggregatorPrices{ + USDT_USD.String(): big.NewFloat(1.05), // average of 1.1, 1.0 }, }, } @@ -141,16 +142,18 @@ func TestAggregateData(t *testing.T) { require.NoError(t, err) // Update the price aggregator with relevant data. - tc.malleate(m.DataAggregator) + tc.malleate(m) // Aggregate the data. m.AggregateData() // Ensure that the aggregated data is as expected. - result := m.DataAggregator.GetAggregatedData() + result := m.GetIndexPrices() require.Equal(t, len(tc.expectedPrices), len(result)) for ticker, price := range result { - math.VerifyPrice(t, tc.expectedPrices[ticker], price, acceptableDelta) + expectedPrice, ok := tc.expectedPrices[ticker] + require.True(t, ok) + require.Equal(t, expectedPrice.SetPrec(36), price.SetPrec(36)) } }) } @@ -160,270 +163,174 @@ func TestCalculateConvertedPrices(t *testing.T) { testCases := []struct { name string target mmtypes.Ticker - paths mmtypes.Paths - malleate func(aggregator types.PriceAggregator) - expectedPrices []*big.Int + cfgs []mmtypes.ProviderConfig + malleate func(aggregator *oracle.MedianAggregator) + expectedPrices []*big.Float }{ { - name: "too many conversion operations", - target: BTC_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - }, - }, - }, - malleate: func(types.PriceAggregator) {}, - expectedPrices: make([]*big.Int, 0), - }, - { - name: "no conversion paths", + name: "no conversion cfgs", target: BTC_USD, - paths: mmtypes.Paths{}, - malleate: func(types.PriceAggregator) {}, - expectedPrices: make([]*big.Int, 0), - }, - { - name: "no conversion operations in a path", - target: BTC_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{}, - }, - }, - }, - malleate: func(types.PriceAggregator) {}, - expectedPrices: make([]*big.Int, 0), + cfgs: []mmtypes.ProviderConfig{}, + malleate: func(*oracle.MedianAggregator) {}, + expectedPrices: make([]*big.Float, 0), }, { name: "single conversion path with a single direct conversion (BTC/USD)", target: BTC_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - }, - }, + cfgs: []mmtypes.ProviderConfig{ + { + Name: coinbase.Name, + OffChainTicker: "BTC-USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) }, - expectedPrices: []*big.Int{createPrice(70_000, BTC_USD.Decimals)}, + expectedPrices: []*big.Float{big.NewFloat(70_000)}, }, { name: "single conversion path with a single adjusted conversion (BTC/USDT * USDT/USD = BTC/USD)", target: BTC_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, + cfgs: []mmtypes.ProviderConfig{ + { + Name: coinbase.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.1), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrices: []*big.Int{createPrice(77_000, BTC_USD.Decimals)}, + expectedPrices: []*big.Float{big.NewFloat(77_000)}, }, { name: "single conversion path with a single adjusted conversion (USDT/BTC * BTC/USD = USDT/USD)", target: USDT_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, + cfgs: []mmtypes.ProviderConfig{ + { + Name: kucoin.Name, + OffChainTicker: "BTC-USDT", + Invert: true, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", }, }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(70_000), } - aggregator.SetProviderData(coinbase.Name, prices) + aggregator.SetProviderData(kucoin.Name, prices) - indexPrices := types.TickerPrices{ - BTC_USD: createPrice(77_000, BTC_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.BITCOIN_USD.String(): big.NewFloat(77_000), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrices: []*big.Int{createPrice(1.1, USDT_USD.Decimals)}, + expectedPrices: []*big.Float{big.NewFloat(1.1)}, }, { name: "single conversion path with a single adjusted conversion (USDC/USDT ^ -1 = USDT/USDC)", target: USDT_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: USDC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, - }, - }, + cfgs: []mmtypes.ProviderConfig{ + { + Name: coinbase.Name, + OffChainTicker: "USDC-USDT", + Invert: true, }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - USDC_USDT: createPrice(1.1, USDC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "USDC-USDT": big.NewFloat(1.1), } aggregator.SetProviderData(coinbase.Name, prices) }, - expectedPrices: []*big.Int{createPrice(0.9090909090909090909090909091, USDT_USD.Decimals)}, + expectedPrices: []*big.Float{big.NewFloat(0.9090909090909090909090909091)}, }, { - name: "two conversion paths both with a single direct conversion (BTC/USD)", + name: "two conversion cfgs both with a single direct conversion (BTC/USD)", target: BTC_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: binance.Name, - Invert: false, - }, - }, - }, + cfgs: []mmtypes.ProviderConfig{ + { + Name: coinbase.Name, + OffChainTicker: "BTC-USD", + }, + { + Name: binance.Name, + OffChainTicker: "BTC-USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - BTC_USD: createPrice(69_000, BTC_USD.Decimals), + prices = types.AggregatorPrices{ + "BTC-USD": big.NewFloat(69_000), } aggregator.SetProviderData(binance.Name, prices) }, - expectedPrices: []*big.Int{ - createPrice(70_000, BTC_USD.Decimals), - createPrice(69_000, BTC_USD.Decimals), + expectedPrices: []*big.Float{ + big.NewFloat(70_000), + big.NewFloat(69_000), }, }, { - name: "two conversion paths both with a single adjusted conversion (BTC/USDT * USDT/USD = BTC/USD)", + name: "two conversion cfgs both with a single adjusted conversion (BTC/USDT * USDT/USD = BTC/USD)", target: BTC_USD, - paths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, + cfgs: []mmtypes.ProviderConfig{ + { + Name: coinbase.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, - { - Operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: binance.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, + }, + { + Name: binance.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) - prices = types.TickerPrices{ - BTC_USDT: createPrice(69_000, BTC_USDT.Decimals), + prices = types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(69_000), } aggregator.SetProviderData(binance.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.1), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrices: []*big.Int{ - createPrice(77_000, BTC_USD.Decimals), - createPrice(75_900, BTC_USD.Decimals), + expectedPrices: []*big.Float{ + big.NewFloat(77_000), + big.NewFloat(75_900), }, }, } @@ -434,10 +341,14 @@ func TestCalculateConvertedPrices(t *testing.T) { require.NoError(t, err) // Update the price aggregator with relevant data. - tc.malleate(m.DataAggregator) + tc.malleate(m) // Calculate the converted prices. - prices := m.CalculateConvertedPrices(tc.target, tc.paths) + market := mmtypes.Market{ + Ticker: tc.target, + ProviderConfigs: tc.cfgs, + } + prices := m.CalculateConvertedPrices(market) require.Len(t, prices, len(tc.expectedPrices)) if len(tc.expectedPrices) == 0 { require.Empty(t, prices) @@ -446,7 +357,7 @@ func TestCalculateConvertedPrices(t *testing.T) { // Ensure that the prices are as expected. for i, price := range prices { - math.VerifyPrice(t, tc.expectedPrices[i], price, acceptableDelta) + require.Equal(t, tc.expectedPrices[i].SetPrec(36), price.SetPrec(36)) } }) } @@ -456,102 +367,60 @@ func TestCalculateAdjustedPrice(t *testing.T) { testCases := []struct { name string target mmtypes.Ticker - operations []mmtypes.Operation - malleate func(aggregator types.PriceAggregator) - expectedPrice *big.Int + cfg mmtypes.ProviderConfig + malleate func(aggregator *oracle.MedianAggregator) + expectedPrice *big.Float expectedErr bool }{ { - name: "nil operations", + name: "empty cfg", target: BTC_USD, - operations: nil, - malleate: func(types.PriceAggregator) {}, - expectedPrice: nil, - expectedErr: true, - }, - { - name: "empty operations", - target: BTC_USD, - operations: []mmtypes.Operation{}, - malleate: func(types.PriceAggregator) {}, - expectedPrice: nil, - expectedErr: true, - }, - { - name: "too many operations", - target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - malleate: func(types.PriceAggregator) {}, + cfg: mmtypes.ProviderConfig{}, + malleate: func(*oracle.MedianAggregator) {}, expectedPrice: nil, expectedErr: true, }, { name: "price does not exist for the provider with an operation that is exactly the target (BTC/USD)", target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "BTC-USD", }, - malleate: func(types.PriceAggregator) {}, + malleate: func(*oracle.MedianAggregator) {}, expectedPrice: nil, expectedErr: true, }, { name: "price exists for the provider with an operation that is exactly the target (BTC/USD)", target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "BTC-USD", }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) }, - expectedPrice: createPrice(70_000, BTC_USD.Decimals), + expectedPrice: big.NewFloat(70_000), expectedErr: false, }, { name: "price needs to be adjusted but the index price does not exist (BTC/USDT * USDT/USD = BTC/USD)", target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC_USDT": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) }, @@ -561,350 +430,188 @@ func TestCalculateAdjustedPrice(t *testing.T) { { name: "price needs to be adjusted and the index price exists (BTC/USDT * USDT/USD = BTC/USD)", target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(70_000), } aggregator.SetProviderData(coinbase.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.0), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrice: createPrice(70_000, BTC_USD.Decimals), + expectedPrice: big.NewFloat(70_000), expectedErr: false, }, { name: "price needs to be inverted to determine the adjusted price (USDT/BTC * BTC/USD = USDT/USD)", target: USDT_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + Name: kucoin.Name, + OffChainTicker: "BTC-USDT", + Invert: true, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(70_000), } - aggregator.SetProviderData(coinbase.Name, prices) + aggregator.SetProviderData(kucoin.Name, prices) - indexPrices := types.TickerPrices{ - BTC_USD: createPrice(70_000, BTC_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.BITCOIN_USD.String(): big.NewFloat(77_000), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrice: createPrice(1, USDT_USD.Decimals), + expectedPrice: big.NewFloat(1.1), expectedErr: false, }, { name: "price is adjusted using USDT/USDC pairings (USDC/USDT ^ -1 = USDT/USDC)", target: USDT_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: USDC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "USDT-USDC", + Invert: true, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - USDC_USDT: createPrice(1.1, USDC_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "USDT-USDC": big.NewFloat(1.1), } aggregator.SetProviderData(coinbase.Name, prices) }, - expectedPrice: createPrice(0.9090909090909090909090909091, USDT_USD.Decimals), + expectedPrice: big.NewFloat(0.9090909090909090909090909091), expectedErr: false, }, { name: "price is adjust using eth pairings (ETH/USDT * USDT/USD = ETH/USD)", target: ETH_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: ETH_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "ETH-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - ETH_USDT: createPrice(4_000, ETH_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "ETH-USDT": big.NewFloat(4_000), } aggregator.SetProviderData(coinbase.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.1), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrice: createPrice(4_400, ETH_USD.Decimals), + expectedPrice: big.NewFloat(4_400), expectedErr: false, }, { name: "price for USDT/USD needs to be adjust by eth prices (USDT/ETH * ETH/USD = USDT/USD)", target: USDT_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: ETH_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, - { - CurrencyPair: ETH_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + Name: kucoin.Name, + OffChainTicker: "ETH-USDT", + Invert: true, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "ETH", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - ETH_USDT: createPrice(4_100, ETH_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "ETH-USDT": big.NewFloat(4_100), } - aggregator.SetProviderData(coinbase.Name, prices) + aggregator.SetProviderData(kucoin.Name, prices) - indexPrices := types.TickerPrices{ - ETH_USD: createPrice(4_000, ETH_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.ETHEREUM_USD.String(): big.NewFloat(4_000), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrice: createPrice(0.97560975, USDT_USD.Decimals), + expectedPrice: big.NewFloat(0.9756097561), expectedErr: false, }, { name: "price for PEPE/USDT needs to be adjusted by USDT/USD (different decimals) (PEPE/USDT * USDT/USD = PEPE/USD)", target: PEPE_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: PEPE_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + OffChainTicker: "PEPEUSDT", + Name: binance.Name, + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - PEPE_USDT: createPrice(0.00000831846, PEPE_USDT.Decimals), + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "PEPEUSDT": big.NewFloat(0.00000831846), } - aggregator.SetProviderData(coinbase.Name, prices) + aggregator.SetProviderData(binance.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.1), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrice: createPrice(0.000009150306, PEPE_USDT.Decimals), + expectedPrice: big.NewFloat(0.000009150306), expectedErr: false, }, { name: "can make a direct conversion with a sufficiently small number (BTC/USD = BTC/USD)", target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "BTC-USD", }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(0.0000001, BTC_USD.Decimals), // 0.0000001 BTC + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USD": big.NewFloat(0.1e-18), } aggregator.SetProviderData(coinbase.Name, prices) }, - expectedPrice: createPrice(0.0000001, BTC_USD.Decimals), + expectedPrice: big.NewFloat(0.1e-18), expectedErr: false, }, { name: "can make a adjusted conversion with a sufficiently small number (BTC/USDT * USDT/USD = BTC/USD)", target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(0.0000001, BTC_USDT.Decimals), // 0.0000001 BTC - } - aggregator.SetProviderData(coinbase.Name, prices) - - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1, USDT_USD.Decimals), - } - aggregator.SetAggregatedData(indexPrices) - }, - expectedPrice: createPrice(0.0000001, BTC_USD.Decimals), - expectedErr: false, - }, - { - name: "can make a adjusted conversion with inverting with a sufficiently small number (USDT/BTC * BTC/USD = USDT/USD)", - target: USDT_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(0.00001, BTC_USDT.Decimals), // 0.00001 BTC - } - aggregator.SetProviderData(coinbase.Name, prices) - - indexPrices := types.TickerPrices{ - BTC_USD: createPrice(0.00002, BTC_USD.Decimals), - } - aggregator.SetAggregatedData(indexPrices) - }, - expectedPrice: createPrice(2, USDT_USD.Decimals), - expectedErr: false, - }, - { - name: "can make a direct conversion with a sufficiently large number (BTC/USD = BTC/USD)", - target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USD: createPrice(1_000_000_000, BTC_USD.Decimals), // 1,000,000,000 BTC - } - aggregator.SetProviderData(coinbase.Name, prices) - }, - expectedPrice: createPrice(1_000_000_000, BTC_USD.Decimals), - expectedErr: false, - }, - { - name: "can make a adjusted conversion with a sufficiently large number (BTC/USDT * USDT/USD = BTC/USD)", - target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, + cfg: mmtypes.ProviderConfig{ + Name: coinbase.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &pkgtypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(1_000_000_000, BTC_USDT.Decimals), // 1,000,000,000 BTC + malleate: func(aggregator *oracle.MedianAggregator) { + prices := types.AggregatorPrices{ + "BTC-USDT": big.NewFloat(0.1e-18), } aggregator.SetProviderData(coinbase.Name, prices) - indexPrices := types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), + indexPrices := types.AggregatorPrices{ + constants.USDT_USD.String(): big.NewFloat(1.0), } - aggregator.SetAggregatedData(indexPrices) + aggregator.SetIndexPrices(indexPrices) }, - expectedPrice: createPrice(1_100_000_000, BTC_USD.Decimals), + expectedPrice: big.NewFloat(0.1e-18), expectedErr: false, }, - { - name: "can make a adjusted conversion with inverting with a sufficiently large number (USDT/BTC * BTC/USD = USDT/USD)", - target: USDT_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - }, - { - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(1_000_000_000, BTC_USDT.Decimals), // 1,000,000,000 BTC - } - aggregator.SetProviderData(coinbase.Name, prices) - - indexPrices := types.TickerPrices{ - BTC_USD: createPrice(1_100_000_000, BTC_USD.Decimals), - } - aggregator.SetAggregatedData(indexPrices) - }, - expectedPrice: createPrice(1.1, USDT_USD.Decimals), - expectedErr: false, - }, - { - name: "second provider is not the index price", - target: BTC_USD, - operations: []mmtypes.Operation{ - { - CurrencyPair: BTC_USDT.CurrencyPair, - Provider: coinbase.Name, - Invert: false, - }, - { - CurrencyPair: USDT_USD.CurrencyPair, - Provider: binance.Name, - Invert: false, - }, - }, - malleate: func(aggregator types.PriceAggregator) { - prices := types.TickerPrices{ - BTC_USDT: createPrice(70_000, BTC_USDT.Decimals), - } - aggregator.SetProviderData(coinbase.Name, prices) - - prices = types.TickerPrices{ - USDT_USD: createPrice(1.1, USDT_USD.Decimals), - } - aggregator.SetProviderData(binance.Name, prices) - }, - expectedPrice: nil, - expectedErr: true, - }, } for _, tc := range testCases { @@ -913,17 +620,17 @@ func TestCalculateAdjustedPrice(t *testing.T) { require.NoError(t, err) // Update the price aggregator with relevant data. - tc.malleate(m.DataAggregator) + tc.malleate(m) // Calculate the adjusted price. - price, err := m.CalculateAdjustedPrice(tc.target, tc.operations) + price, err := m.CalculateAdjustedPrice(tc.cfg) if tc.expectedErr { require.Error(t, err) return } require.NoError(t, err) - math.VerifyPrice(t, tc.expectedPrice, price, acceptableDelta) + require.Equal(t, tc.expectedPrice.SetPrec(uint(36)), price.SetPrec(uint(36))) }) } } diff --git a/pkg/math/oracle/utils.go b/pkg/math/oracle/utils.go index d517b58c3..8122cf6b6 100644 --- a/pkg/math/oracle/utils.go +++ b/pkg/math/oracle/utils.go @@ -2,73 +2,82 @@ package oracle import ( "fmt" + "maps" "math/big" "github.com/skip-mev/slinky/oracle/types" + pkgtypes "github.com/skip-mev/slinky/pkg/types" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -// GetTickerFromOperation returns the ticker for the given operation. -func (m *MedianAggregator) GetTickerFromOperation( - operation mmtypes.Operation, -) (mmtypes.Ticker, error) { - cfg := m.GetMarketMap() - ticker, ok := cfg.Tickers[operation.CurrencyPair.String()] +// GetProviderPrice returns the relevant provider price. Note that the aggregator's +// provider data cache stores prices in the form of providerName -> offChainTicker -> price. +func (m *MedianAggregator) GetProviderPrice( + cfg mmtypes.ProviderConfig, +) (*big.Float, error) { + cache, ok := m.providerPrices[cfg.Name] if !ok { - return mmtypes.Ticker{}, fmt.Errorf("missing ticker: %s", operation.CurrencyPair.String()) + return nil, fmt.Errorf("missing provider prices for provider: %s", cfg.Name) } - return ticker, nil -} - -// GetProviderPrice returns the relevant provider price. Note that if the operation -// is for the index provider, then the price is retrieved from the previously calculated -// median prices. Otherwise, the price is retrieved from the provider cache. Additionally, -// this function normalizes (scales, inverts) the price to maintain the maximum precision. -func (m *MedianAggregator) GetProviderPrice( - operation mmtypes.Operation, -) (*big.Int, error) { - ticker, err := m.GetTickerFromOperation(operation) - if err != nil { - return nil, err + price, ok := cache[cfg.OffChainTicker] + if !ok { + return nil, fmt.Errorf("missing %s price for ticker: %s", cfg.Name, cfg.OffChainTicker) } - var cache types.TickerPrices - if operation.Provider != mmtypes.IndexPrice { - cache = m.GetDataByProvider(operation.Provider) - } else { - cache = m.GetAggregatedData() + if cfg.Invert { + return new(big.Float).Quo(big.NewFloat(1), price), nil } - price, ok := cache[ticker] + return price, nil +} + +// GetIndexPrice returns the relevant index price. Note that the aggregator's +// index price cache stores prices in the form of ticker -> price. +func (m *MedianAggregator) GetIndexPrice( + cp pkgtypes.CurrencyPair, +) (*big.Float, error) { + price, ok := m.indexPrices[cp.String()] if !ok { - return nil, fmt.Errorf("missing %s price for ticker: %s", operation.Provider, ticker.String()) + return nil, fmt.Errorf("missing index price for ticker: %s", cp) } - scaledPrice, err := ScaleUpCurrencyPairPrice(ticker.Decimals, price) - if err != nil { - return nil, err - } + return price, nil +} - if operation.Invert { - scaledPrice = InvertCurrencyPairPrice(scaledPrice, ScaledDecimals) - } +// SetIndexPrice sets the index price for the given currency pair. +func (m *MedianAggregator) SetIndexPrices( + prices types.AggregatorPrices, +) { + m.mtx.Lock() + defer m.mtx.Unlock() + + m.indexPrices = prices +} + +// GetIndexPrices returns the index prices the aggregator has. +func (m *MedianAggregator) GetIndexPrices() types.AggregatorPrices { + m.mtx.Lock() + defer m.mtx.Unlock() + + cpy := make(types.AggregatorPrices) + maps.Copy(cpy, m.indexPrices) - return scaledPrice, nil + return cpy } // UpdateMarketMap updates the market map for the oracle. func (m *MedianAggregator) UpdateMarketMap(marketMap mmtypes.MarketMap) { - m.Lock() - defer m.Unlock() + m.mtx.Lock() + defer m.mtx.Unlock() m.cfg = marketMap } // GetMarketMap returns the market map for the oracle. func (m *MedianAggregator) GetMarketMap() *mmtypes.MarketMap { - m.Lock() - defer m.Unlock() + m.mtx.Lock() + defer m.mtx.Unlock() return &m.cfg } diff --git a/pkg/math/oracle/utils_test.go b/pkg/math/oracle/utils_test.go index f7ee4487d..1633d79ef 100644 --- a/pkg/math/oracle/utils_test.go +++ b/pkg/math/oracle/utils_test.go @@ -1,177 +1,105 @@ package oracle_test import ( + "math/big" "testing" "github.com/stretchr/testify/require" "github.com/skip-mev/slinky/oracle/constants" - "github.com/skip-mev/slinky/oracle/metrics" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" "github.com/skip-mev/slinky/pkg/math/oracle" - "github.com/skip-mev/slinky/providers/apis/coinbase" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -func TestGetTickerFromOperation(t *testing.T) { - t.Run("has ticker included in the market config", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) - require.NoError(t, err) - - operation := mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - } - ticker, err := m.GetTickerFromOperation(operation) - require.NoError(t, err) - require.Equal(t, BTC_USD, ticker) - }) - - t.Run("has ticker not included in the market config", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) - require.NoError(t, err) - - operation := mmtypes.Operation{ - CurrencyPair: constants.MOG_USD.CurrencyPair, - } - ticker, err := m.GetTickerFromOperation(operation) - require.Error(t, err) - require.Empty(t, ticker) - }) -} - func TestGetProviderPrice(t *testing.T) { - t.Run("does not have a ticker in the config", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) + t.Run("provider does not exist in the cache", func(t *testing.T) { + agg, err := oracle.NewMedianAggregator(logger, marketmap, nil) require.NoError(t, err) - operation := mmtypes.Operation{ - CurrencyPair: constants.MOG_USD.CurrencyPair, + cfg := mmtypes.ProviderConfig{ + Name: "test", + OffChainTicker: "BTC/USD", } - _, err = m.GetProviderPrice(operation) + _, err = agg.GetProviderPrice(cfg) require.Error(t, err) }) - t.Run("has no provider prices or index prices", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) + t.Run("provider exists in the cache but does not have the desired CP", func(t *testing.T) { + agg, err := oracle.NewMedianAggregator(logger, marketmap, nil) require.NoError(t, err) - // Attempt to retrieve the provider. - operation := mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, + cfg := mmtypes.ProviderConfig{ + Name: "test", + OffChainTicker: "BTC/USD", } - _, err = m.GetProviderPrice(operation) - require.Error(t, err) - - // Attempt to retrieve the index price. - operation = mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, + prices := types.AggregatorPrices{ + "BTC/USDT": big.NewFloat(100), } - _, err = m.GetProviderPrice(operation) + agg.SetProviderData("test", prices) + + _, err = agg.GetProviderPrice(cfg) require.Error(t, err) }) - t.Run("has provider prices but no index prices", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) + t.Run("provider exists in the cache and has the desired CP", func(t *testing.T) { + agg, err := oracle.NewMedianAggregator(logger, marketmap, nil) require.NoError(t, err) - // Set the provider price. - prices := types.TickerPrices{ - BTC_USD: createPrice(100, BTC_USD.Decimals), + cfg := mmtypes.ProviderConfig{ + Name: "test", + OffChainTicker: "BTC/USD", } - m.DataAggregator.SetProviderData(coinbase.Name, prices) - - // Attempt to retrieve the provider. - operation := mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, + prices := types.AggregatorPrices{ + "BTC/USD": big.NewFloat(100), } - price, err := m.GetProviderPrice(operation) - require.NoError(t, err) - require.Equal(t, createPrice(100, oracle.ScaledDecimals), price) + agg.SetProviderData("test", prices) - // Attempt to retrieve the index price. - operation = mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - } - _, err = m.GetProviderPrice(operation) - require.Error(t, err) + price, err := agg.GetProviderPrice(cfg) + require.NoError(t, err) + require.Equal(t, big.NewFloat(100), price) }) - t.Run("has provider prices and index prices", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) + t.Run("provider exists in the cache and has the desired CP, invert is true", func(t *testing.T) { + agg, err := oracle.NewMedianAggregator(logger, marketmap, nil) require.NoError(t, err) - // Set the provider price. - prices := types.TickerPrices{ - BTC_USD: createPrice(100, BTC_USD.Decimals), + cfg := mmtypes.ProviderConfig{ + Name: "test", + OffChainTicker: "BTC/USD", + Invert: true, } - m.DataAggregator.SetProviderData(coinbase.Name, prices) - - // Set the index price. - m.DataAggregator.SetAggregatedData(prices) - - // Attempt to retrieve the provider. - operation := mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, + prices := types.AggregatorPrices{ + "BTC/USD": big.NewFloat(100), } - price, err := m.GetProviderPrice(operation) - require.NoError(t, err) - require.Equal(t, createPrice(100, oracle.ScaledDecimals), price) + agg.SetProviderData("test", prices) - // Attempt to retrieve the index price. - operation = mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: mmtypes.IndexPrice, - } - price, err = m.GetProviderPrice(operation) + price, err := agg.GetProviderPrice(cfg) require.NoError(t, err) - require.Equal(t, createPrice(100, oracle.ScaledDecimals), price) + require.Equal(t, big.NewFloat(0.01).SetPrec(18), price.SetPrec(18)) }) +} - t.Run("has provider prices and can correctly scale up", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) +func TestGetIndexPrice(t *testing.T) { + t.Run("has no index prices", func(t *testing.T) { + agg, err := oracle.NewMedianAggregator(logger, marketmap, nil) require.NoError(t, err) - // Set the provider price. - prices := types.TickerPrices{ - BTC_USD: createPrice(40_000, BTC_USD.Decimals), - } - m.DataAggregator.SetProviderData(coinbase.Name, prices) - - // Attempt to retrieve the provider. - operation := mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - } - price, err := m.GetProviderPrice(operation) - require.NoError(t, err) - require.Equal(t, createPrice(40_000, oracle.ScaledDecimals), price) + _, err = agg.GetIndexPrice(constants.ETHEREUM_USD) + require.Error(t, err) }) - t.Run("has provider prices and can correctly invert", func(t *testing.T) { - m, err := oracle.NewMedianAggregator(logger, marketmap, metrics.NewNopMetrics()) + t.Run("has index prices", func(t *testing.T) { + agg, err := oracle.NewMedianAggregator(logger, marketmap, nil) require.NoError(t, err) - // Set the provider price. - prices := types.TickerPrices{ - BTC_USD: createPrice(40_000, BTC_USD.Decimals), + prices := types.AggregatorPrices{ + constants.BITCOIN_USD.String(): big.NewFloat(100), } - m.DataAggregator.SetProviderData(coinbase.Name, prices) + agg.SetIndexPrices(prices) - // Attempt to retrieve the provider. - operation := mmtypes.Operation{ - CurrencyPair: BTC_USD.CurrencyPair, - Provider: coinbase.Name, - Invert: true, - } - price, err := m.GetProviderPrice(operation) + price, err := agg.GetIndexPrice(constants.BITCOIN_USD) require.NoError(t, err) - expectedPrice := createPrice(0.000025, oracle.ScaledDecimals) - math.VerifyPrice(t, expectedPrice, price, acceptableDelta) + require.Equal(t, big.NewFloat(100), price) }) } diff --git a/proto/slinky/marketmap/module/v1/module.proto b/proto/slinky/marketmap/module/v1/module.proto index e222b1114..9c3bc333c 100644 --- a/proto/slinky/marketmap/module/v1/module.proto +++ b/proto/slinky/marketmap/module/v1/module.proto @@ -18,4 +18,4 @@ message Module { // of module names which provide a marketmap hooks instance. If no order is // provided, then hooks will be applied in alphabetical order of module names. repeated string hooks_order = 2; -} +} \ No newline at end of file diff --git a/proto/slinky/marketmap/v1/market.proto b/proto/slinky/marketmap/v1/market.proto index c8cf00c6f..b2f9df01f 100644 --- a/proto/slinky/marketmap/v1/market.proto +++ b/proto/slinky/marketmap/v1/market.proto @@ -6,6 +6,20 @@ option go_package = "github.com/skip-mev/slinky/x/marketmap/types"; import "gogoproto/gogo.proto"; import "slinky/types/v1/currency_pair.proto"; +// Market encapsulates a Ticker and its provider-specific configuration. +message Market { + option (gogoproto.goproto_stringer) = false; + option (gogoproto.stringer) = false; + + // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The + // price feed is scaled to a number of decimal places and has a minimum number + // of providers required to consider the ticker valid. + Ticker ticker = 1 [ (gogoproto.nullable) = false ]; + + // ProviderConfigs is the list of provider-specific configs for this Market. + repeated ProviderConfig provider_configs = 2 [ (gogoproto.nullable) = false ]; +} + // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price // feed is scaled to a number of decimal places and has a minimum number of // providers required to consider the ticker valid. @@ -43,76 +57,28 @@ message ProviderConfig { // The off-chain ticker is unique to a given provider and is used to fetch the // price of the ticker from the provider. string off_chain_ticker = 2; -} - -// Path is the list of convertable markets that will be used to convert the -// prices of a set of tickers to a common ticker. -message Path { - // Operations is an ordered list of operations that will be taken. These must - // be topologically sorted to ensure that the conversion is possible i.e. DAG. - repeated Operation operations = 1 [ (gogoproto.nullable) = false ]; -} - -// Operation represents the operation configuration for a given ticker. -message Operation { - // CurrencyPair is the on-chain currency pair for this ticker. - slinky.types.v1.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; - - // Invert is a boolean that indicates whether the price of the ticker should - // be inverted. - bool invert = 2; - - // Provider is the name of the provider that will be used to fetch the price - // of the ticker. - string provider = 3; -} -message Paths { - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - repeated Path paths = 1 [ (gogoproto.nullable) = false ]; -} + // NormalizeByPair is the currency pair for this ticker to be normalized by. + // For example, if the desired Ticker is BTD/USD, this market could be reached + // using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is + // optional and nullable. + slinky.types.v1.CurrencyPair normalize_by_pair = 3; -message Providers { - // Providers is the list of provider configurations for the given ticker. - repeated ProviderConfig providers = 1 [ (gogoproto.nullable) = false ]; -} + // Invert is a boolean indicating if the BASE and QUOTE of the market should + // be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE + bool invert = 4; -// AggregationType is the type of aggregation that will be used to aggregate the -// prices of the tickers. -enum AggregationType { - // UNKOWN_AGGREGATION_TYPE is the default value for the aggregation type. - UNKNOWN_AGGREGATION_TYPE = 0; - - // IndexPriceAggregation is the type of aggregation that will be used to - // aggregate the prices of the tickers. Specifically, this converts the prices - // either directly or using the index price to a common currency pair. - INDEX_PRICE_AGGREGATION = 1; - - // StandardMedianAggregation is the type of aggregation that will be used to - // aggregate the prices of the tickers. Specifically, this converts the prices - // to a common currency pair and then takes the median of the prices. No - // conversions are done if the prices are already in the common currency pair. - STANDARD_MEDIAN_AGGREGATION = 2; + // MetadataJSON is a string of JSON that encodes any extra configuration + // for the given provider config. + string metadata_JSON = 15; } +// MarketMap maps ticker strings to their Markets. message MarketMap { option (gogoproto.goproto_stringer) = false; option (gogoproto.stringer) = false; - // Tickers is the full list of tickers and their associated configurations + // Markets is the full list of tickers and their associated configurations // to be stored on-chain. - map tickers = 1 [ (gogoproto.nullable) = false ]; - - // Paths is a map from CurrencyPair to all paths that resolve to that pair - map paths = 2 [ (gogoproto.nullable) = false ]; - - // Providers is a map from CurrencyPair to each of to provider-specific - // configs associated with it. - map providers = 3 [ (gogoproto.nullable) = false ]; - - // AggregationType is the type of aggregation that will be used to aggregate - // the prices of the tickers. - AggregationType aggregation_type = 4; + map markets = 1 [ (gogoproto.nullable) = false ]; } diff --git a/proto/slinky/marketmap/v1/params.proto b/proto/slinky/marketmap/v1/params.proto index 78a746bb1..b93f590ea 100644 --- a/proto/slinky/marketmap/v1/params.proto +++ b/proto/slinky/marketmap/v1/params.proto @@ -5,11 +5,11 @@ option go_package = "github.com/skip-mev/slinky/x/marketmap/types"; // Params defines the parameters for the x/marketmap module. message Params { - // MarketAuthority is the authority account that is able to control updating - // the marketmap. - string market_authority = 1; + // MarketAuthorities is the list of authority accounts that are able to + // control updating the marketmap. + repeated string market_authorities = 1; - // Version is the schema version for the MarketMap data structure and query - // response. - uint64 version = 2; + // Admin is an address that can remove addresses from the MarketAuthorities + // list. Only governance can add to the MarketAuthorities or change the Admin. + string admin = 2; } diff --git a/proto/slinky/marketmap/v1/query.proto b/proto/slinky/marketmap/v1/query.proto index 43e5b184c..94a36300a 100644 --- a/proto/slinky/marketmap/v1/query.proto +++ b/proto/slinky/marketmap/v1/query.proto @@ -3,6 +3,7 @@ package slinky.marketmap.v1; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; +import "slinky/types/v1/currency_pair.proto"; import "slinky/marketmap/v1/market.proto"; import "slinky/marketmap/v1/params.proto"; @@ -12,12 +13,18 @@ option go_package = "github.com/skip-mev/slinky/x/marketmap/types"; service Query { // MarketMap returns the full market map stored in the x/marketmap // module. - rpc MarketMap(GetMarketMapRequest) returns (GetMarketMapResponse) { + rpc MarketMap(MarketMapRequest) returns (MarketMapResponse) { option (google.api.http).get = "/slinky/marketmap/v1/marketmap"; } + // Market returns a market stored in the x/marketmap + // module. + rpc Market(MarketRequest) returns (MarketResponse) { + option (google.api.http).get = "/slinky/marketmap/v1/market"; + } + // LastUpdated returns the last height the market map was updated at. - rpc LastUpdated(GetLastUpdatedRequest) returns (GetLastUpdatedResponse) { + rpc LastUpdated(LastUpdatedRequest) returns (LastUpdatedResponse) { option (google.api.http).get = "/slinky/marketmap/v1/last_updated"; } @@ -29,12 +36,12 @@ service Query { } } -// GetMarketMapRequest is the query request for the GetMarketMap query. +// MarketMapRequest is the query request for the MarketMap query. // It takes no arguments. -message GetMarketMapRequest {} +message MarketMapRequest {} -// GetMarketMapResponse is the query response for the GetMarketMap query. -message GetMarketMapResponse { +// MarketMapResponse is the query response for the MarketMap query. +message MarketMapResponse { // MarketMap defines the global set of market configurations for all providers // and markets. MarketMap market_map = 1 [ (gogoproto.nullable) = false ]; @@ -44,12 +51,23 @@ message GetMarketMapResponse { // is a new update to the map. uint64 last_updated = 2; - // Version is the schema version for the MarketMap data structure and query - // response. - uint64 version = 3; - // ChainId is the chain identifier for the market map. - string chain_id = 4; + string chain_id = 3; +} + +// MarketRequest is the query request for the Market query. +// It takes the currency pair of the market as an argument. +message MarketRequest { + // CurrencyPair is the currency pair associated with the market being + // requested. + slinky.types.v1.CurrencyPair currency_pair = 3 + [ (gogoproto.nullable) = false ]; +} + +// MarketResponse is the query response for the Market query. +message MarketResponse { + // Market is the configuration of a single market to be price-fetched for. + Market market = 1 [ (gogoproto.nullable) = false ]; } // ParamsRequest is the request type for the Query/Params RPC method. @@ -58,10 +76,10 @@ message ParamsRequest {} // ParamsResponse is the response type for the Query/Params RPC method. message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } -// GetLastUpdatedRequest is the request type for the Query/LastUpdated RPC +// LastUpdatedRequest is the request type for the Query/LastUpdated RPC // method. -message GetLastUpdatedRequest {} +message LastUpdatedRequest {} -// GetLastUpdatedResponse is the response type for the Query/LastUpdated RPC +// LastUpdatedResponse is the response type for the Query/LastUpdated RPC // method. -message GetLastUpdatedResponse { uint64 last_updated = 1; } +message LastUpdatedResponse { uint64 last_updated = 1; } \ No newline at end of file diff --git a/proto/slinky/marketmap/v1/tx.proto b/proto/slinky/marketmap/v1/tx.proto index 2534ccce9..b873fe126 100644 --- a/proto/slinky/marketmap/v1/tx.proto +++ b/proto/slinky/marketmap/v1/tx.proto @@ -14,46 +14,60 @@ option go_package = "github.com/skip-mev/slinky/x/marketmap/types"; service Msg { option (cosmos.msg.v1.service) = true; - // UpdateMarketMap creates markets from the given message. - rpc UpdateMarketMap(MsgUpdateMarketMap) returns (MsgUpdateMarketMapResponse); + // CreateMarkets creates markets from the given message. + rpc CreateMarkets(MsgCreateMarkets) returns (MsgCreateMarketsResponse); + + // UpdateMarkets updates markets from the given message. + rpc UpdateMarkets(MsgUpdateMarkets) returns (MsgUpdateMarketsResponse); // Params defines a method for updating the x/marketmap module parameters. rpc Params(MsgParams) returns (MsgParamsResponse); + + // RemoveMarketAuthorities defines a method for removing market authorities + // from the x/marketmap module. the signer must be the admin. + rpc RemoveMarketAuthorities(MsgRemoveMarketAuthorities) + returns (MsgRemoveMarketAuthoritiesResponse); } -// CreateMarket contains all information needed to create a new market. -message CreateMarket { - // Ticker is the on-chain representation of the ticker. This is the target - // ticker that the prices of the set of tickers will be converted to. - Ticker ticker = 1 [ (gogoproto.nullable) = false ]; +// MsgCreateMarkets defines a message carrying a payload for creating markets in +// the x/marketmap module. +message MsgCreateMarkets { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "slinky/x/marketmap/MsgCreateMarkets"; + + option (gogoproto.equal) = false; - // Providers maps provider names to their off-chain - // representations for the given ticker of the message. - Providers providers = 2 [ (gogoproto.nullable) = false ]; + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - Paths paths = 3 [ (gogoproto.nullable) = false ]; + // CreateMarkets is the list of all markets to be created for the given + // transaction. + repeated Market create_markets = 2 [ (gogoproto.nullable) = false ]; } -// MsgUpdateMarketMap defines a message carrying a payload for updating the +// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. +message MsgCreateMarketsResponse {} + +// MsgUpdateMarkets defines a message carrying a payload for updating the // x/marketmap module. -message MsgUpdateMarketMap { - option (cosmos.msg.v1.signer) = "signer"; - option (amino.name) = "slinky/x/marketmap/MsgUpdateMarketMap"; +message MsgUpdateMarkets { + option (cosmos.msg.v1.signer) = "authority"; + option (amino.name) = "slinky/x/marketmap/MsgUpdateMarkets"; option (gogoproto.equal) = false; - // Signer is the signer of this transaction. - string signer = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - // CreateMarkets is the list of all markets to be created for the given + // UpdateMarkets is the list of all markets to be updated for the given // transaction. - repeated CreateMarket create_markets = 2 [ (gogoproto.nullable) = false ]; + repeated Market update_markets = 2 [ (gogoproto.nullable) = false ]; } -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -message MsgUpdateMarketMapResponse {} +// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. +message MsgUpdateMarketsResponse {} // MsgParams defines the Msg/Params request type. It contains the // new parameters for the x/marketmap module. @@ -69,3 +83,21 @@ message MsgParams { // MsgParamsResponse defines the Msg/Params response type. message MsgParamsResponse {} + +// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse +// request type. It contains the new addresses to remove from the list of +// authorities +message MsgRemoveMarketAuthorities { + option (cosmos.msg.v1.signer) = "admin"; + + // RemoveAddresses is the list of addresses to remove. + repeated string remove_addresses = 1; + + // Admin defines the authority that is the x/marketmap + // Admin account. This account is set in the module parameters. + string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; +} + +// MsgRemoveMarketAuthoritiesResponse defines the +// Msg/RemoveMarketAuthoritiesResponse response type. +message MsgRemoveMarketAuthoritiesResponse {} diff --git a/proto/slinky/mm2/module/v1/module.proto b/proto/slinky/mm2/module/v1/module.proto deleted file mode 100644 index 24273a3c4..000000000 --- a/proto/slinky/mm2/module/v1/module.proto +++ /dev/null @@ -1,21 +0,0 @@ -syntax = "proto3"; - -package slinky.mm2.module.v1; - -import "cosmos/app/v1alpha1/module.proto"; - -// Module is the config object of the builder module. -message Module { - option (cosmos.app.v1alpha1.module) = { - go_import : "github.com/skip-mev/slinky/x/mm2" - }; - - // Authority defines the custom module authority. If not set, defaults to the - // governance module. - string authority = 1; - - // HooksOrder specifies the order of marketmap hooks and should be a list - // of module names which provide a marketmap hooks instance. If no order is - // provided, then hooks will be applied in alphabetical order of module names. - repeated string hooks_order = 2; -} \ No newline at end of file diff --git a/proto/slinky/mm2/v1/genesis.proto b/proto/slinky/mm2/v1/genesis.proto deleted file mode 100644 index 5644a76e3..000000000 --- a/proto/slinky/mm2/v1/genesis.proto +++ /dev/null @@ -1,23 +0,0 @@ -syntax = "proto3"; -package slinky.mm2.v1; - -import "gogoproto/gogo.proto"; -import "slinky/mm2/v1/market.proto"; -import "slinky/mm2/v1/params.proto"; - -option go_package = "github.com/skip-mev/slinky/x/mm2/types"; - -// GenesisState defines the x/marketmap module's genesis state. -message GenesisState { - // MarketMap defines the global set of market configurations for all providers - // and markets. - MarketMap market_map = 1 [ (gogoproto.nullable) = false ]; - - // LastUpdated is the last block height that the market map was updated. - // This field can be used as an optimization for clients checking if there - // is a new update to the map. - uint64 last_updated = 2; - - // Params are the parameters for the x/marketmap module. - Params params = 3 [ (gogoproto.nullable) = false ]; -} diff --git a/proto/slinky/mm2/v1/market.proto b/proto/slinky/mm2/v1/market.proto deleted file mode 100644 index 359976b48..000000000 --- a/proto/slinky/mm2/v1/market.proto +++ /dev/null @@ -1,84 +0,0 @@ -syntax = "proto3"; -package slinky.mm2.v1; - -option go_package = "github.com/skip-mev/slinky/x/mm2/types"; - -import "gogoproto/gogo.proto"; -import "slinky/types/v1/currency_pair.proto"; - -// Market encapsulates a Ticker and its provider-specific configuration. -message Market { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - - // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The - // price feed is scaled to a number of decimal places and has a minimum number - // of providers required to consider the ticker valid. - Ticker ticker = 1 [ (gogoproto.nullable) = false ]; - - // ProviderConfigs is the list of provider-specific configs for this Market. - repeated ProviderConfig provider_configs = 2 [ (gogoproto.nullable) = false ]; -} - -// Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price -// feed is scaled to a number of decimal places and has a minimum number of -// providers required to consider the ticker valid. -message Ticker { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - - // CurrencyPair is the currency pair for this ticker. - slinky.types.v1.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; - - // Decimals is the number of decimal places for the ticker. The number of - // decimal places is used to convert the price to a human-readable format. - uint64 decimals = 2; - - // MinProviderCount is the minimum number of providers required to consider - // the ticker valid. - uint64 min_provider_count = 3; - - // Enabled is the flag that denotes if the Ticker is enabled for price - // fetching by an oracle. - bool enabled = 14; - - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given ticker. - string metadata_JSON = 15; -} - -message ProviderConfig { - // Name corresponds to the name of the provider for which the configuration is - // being set. - string name = 1; - - // OffChainTicker is the off-chain representation of the ticker i.e. BTC/USD. - // The off-chain ticker is unique to a given provider and is used to fetch the - // price of the ticker from the provider. - string off_chain_ticker = 2; - - // NormalizeByPair is the currency pair for this ticker to be normalized by. - // For example, if the desired Ticker is BTD/USD, this market could be reached - // using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is - // optional and nullable. - slinky.types.v1.CurrencyPair normalize_by_pair = 3; - - // Invert is a boolean indicating if the BASE and QUOTE of the market should - // be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE - bool invert = 4; - - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given provider config. - string metadata_JSON = 15; -} - -// MarketMap maps ticker strings to their Markets. -message MarketMap { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - - // Markets is the full list of tickers and their associated configurations - // to be stored on-chain. - map markets = 1 [ (gogoproto.nullable) = false ]; -} diff --git a/proto/slinky/mm2/v1/params.proto b/proto/slinky/mm2/v1/params.proto deleted file mode 100644 index 1700ea87e..000000000 --- a/proto/slinky/mm2/v1/params.proto +++ /dev/null @@ -1,15 +0,0 @@ -syntax = "proto3"; -package slinky.mm2.v1; - -option go_package = "github.com/skip-mev/slinky/x/mm2/types"; - -// Params defines the parameters for the x/marketmap module. -message Params { - // MarketAuthorities is the list of authority accounts that are able to - // control updating the marketmap. - repeated string market_authorities = 1; - - // Admin is an address that can remove addresses from the MarketAuthorities - // list. Only governance can add to the MarketAuthorities or change the Admin. - string admin = 2; -} diff --git a/proto/slinky/mm2/v1/query.proto b/proto/slinky/mm2/v1/query.proto deleted file mode 100644 index 37297f3de..000000000 --- a/proto/slinky/mm2/v1/query.proto +++ /dev/null @@ -1,85 +0,0 @@ -syntax = "proto3"; -package slinky.mm2.v1; - -import "gogoproto/gogo.proto"; -import "google/api/annotations.proto"; -import "slinky/types/v1/currency_pair.proto"; -import "slinky/mm2/v1/market.proto"; -import "slinky/mm2/v1/params.proto"; - -option go_package = "github.com/skip-mev/slinky/x/mm2/types"; - -// Query is the query service for the x/marketmap module. -service Query { - // MarketMap returns the full market map stored in the x/marketmap - // module. - rpc MarketMap(MarketMapRequest) returns (MarketMapResponse) { - option (google.api.http).get = "/slinky/mm2/v1/marketmap"; - } - - // Market returns a market stored in the x/marketmap - // module. - rpc Market(MarketRequest) returns (MarketResponse) { - option (google.api.http).get = "/slinky/mm2/v1/market"; - } - - // LastUpdated returns the last height the market map was updated at. - rpc LastUpdated(LastUpdatedRequest) returns (LastUpdatedResponse) { - option (google.api.http).get = "/slinky/mm2/v1/last_updated"; - } - - // Params returns the current x/marketmap module parameters. - rpc Params(ParamsRequest) returns (ParamsResponse) { - option (google.api.http) = { - get : "/slinky/mm2/v1/params" - }; - } -} - -// MarketMapRequest is the query request for the MarketMap query. -// It takes no arguments. -message MarketMapRequest {} - -// MarketMapResponse is the query response for the MarketMap query. -message MarketMapResponse { - // MarketMap defines the global set of market configurations for all providers - // and markets. - MarketMap market_map = 1 [ (gogoproto.nullable) = false ]; - - // LastUpdated is the last block height that the market map was updated. - // This field can be used as an optimization for clients checking if there - // is a new update to the map. - uint64 last_updated = 2; - - // ChainId is the chain identifier for the market map. - string chain_id = 3; -} - -// MarketRequest is the query request for the Market query. -// It takes the currency pair of the market as an argument. -message MarketRequest { - // CurrencyPair is the currency pair associated with the market being - // requested. - slinky.types.v1.CurrencyPair currency_pair = 3 - [ (gogoproto.nullable) = false ]; -} - -// MarketResponse is the query response for the Market query. -message MarketResponse { - // Market is the configuration of a single market to be price-fetched for. - Market market = 1 [ (gogoproto.nullable) = false ]; -} - -// ParamsRequest is the request type for the Query/Params RPC method. -message ParamsRequest {} - -// ParamsResponse is the response type for the Query/Params RPC method. -message ParamsResponse { Params params = 1 [ (gogoproto.nullable) = false ]; } - -// LastUpdatedRequest is the request type for the Query/LastUpdated RPC -// method. -message LastUpdatedRequest {} - -// LastUpdatedResponse is the response type for the Query/LastUpdated RPC -// method. -message LastUpdatedResponse { uint64 last_updated = 1; } \ No newline at end of file diff --git a/proto/slinky/mm2/v1/tx.proto b/proto/slinky/mm2/v1/tx.proto deleted file mode 100644 index 3e6321f0f..000000000 --- a/proto/slinky/mm2/v1/tx.proto +++ /dev/null @@ -1,103 +0,0 @@ -syntax = "proto3"; -package slinky.mm2.v1; - -import "cosmos/msg/v1/msg.proto"; -import "gogoproto/gogo.proto"; -import "cosmos_proto/cosmos.proto"; -import "amino/amino.proto"; -import "slinky/mm2/v1/market.proto"; -import "slinky/mm2/v1/params.proto"; - -option go_package = "github.com/skip-mev/slinky/x/mm2/types"; - -// Msg is the message service for the x/marketmap module. -service Msg { - option (cosmos.msg.v1.service) = true; - - // CreateMarkets creates markets from the given message. - rpc CreateMarkets(MsgCreateMarkets) returns (MsgCreateMarketsResponse); - - // UpdateMarkets updates markets from the given message. - rpc UpdateMarkets(MsgUpdateMarkets) returns (MsgUpdateMarketsResponse); - - // Params defines a method for updating the x/marketmap module parameters. - rpc Params(MsgParams) returns (MsgParamsResponse); - - // RemoveMarketAuthorities defines a method for removing market authorities - // from the x/marketmap module. the signer must be the admin. - rpc RemoveMarketAuthorities(MsgRemoveMarketAuthorities) - returns (MsgRemoveMarketAuthoritiesResponse); -} - -// MsgCreateMarkets defines a message carrying a payload for creating markets in -// the x/marketmap module. -message MsgCreateMarkets { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "slinky/x/marketmap/MsgCreateMarkets"; - - option (gogoproto.equal) = false; - - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // CreateMarkets is the list of all markets to be created for the given - // transaction. - repeated Market create_markets = 2 [ (gogoproto.nullable) = false ]; -} - -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -message MsgCreateMarketsResponse {} - -// MsgUpdateMarkets defines a message carrying a payload for updating the -// x/marketmap module. -message MsgUpdateMarkets { - option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "slinky/x/marketmap/MsgUpdateMarkets"; - - option (gogoproto.equal) = false; - - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - - // UpdateMarkets is the list of all markets to be updated for the given - // transaction. - repeated Market update_markets = 2 [ (gogoproto.nullable) = false ]; -} - -// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. -message MsgUpdateMarketsResponse {} - -// MsgParams defines the Msg/Params request type. It contains the -// new parameters for the x/marketmap module. -message MsgParams { - option (cosmos.msg.v1.signer) = "authority"; - - // Params defines the new parameters for the x/marketmap module. - Params params = 1 [ (gogoproto.nullable) = false ]; - // Authority defines the authority that is updating the x/marketmap module - // parameters. - string authority = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} - -// MsgParamsResponse defines the Msg/Params response type. -message MsgParamsResponse {} - -// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse -// request type. It contains the new addresses to remove from the list of -// authorities -message MsgRemoveMarketAuthorities { - option (cosmos.msg.v1.signer) = "admin"; - - // RemoveAddresses is the list of addresses to remove. - repeated string remove_addresses = 1; - - // Admin defines the authority that is the x/marketmap - // Admin account. This account is set in the module parameters. - string admin = 2 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; -} - -// MsgRemoveMarketAuthoritiesResponse defines the -// Msg/RemoveMarketAuthoritiesResponse response type. -message MsgRemoveMarketAuthoritiesResponse {} diff --git a/providers/apis/binance/api_handler.go b/providers/apis/binance/api_handler.go index e9f1932f2..79da1e1e0 100644 --- a/providers/apis/binance/api_handler.go +++ b/providers/apis/binance/api_handler.go @@ -12,7 +12,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIDataHandler = (*APIHandler)(nil) @@ -21,25 +20,16 @@ var _ types.PriceAPIDataHandler = (*APIHandler)(nil) // for more information about the Binance API, refer to the following link: // https://github.com/binance/binance-spot-api-docs/blob/master/rest-api.md#public-api-endpoints type APIHandler struct { - // market is the config for the Binance API. - market types.ProviderMarketMap // api is the config for the Binance API. api config.APIConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewAPIHandler returns a new Binance PriceAPIDataHandler. func NewAPIHandler( - market types.ProviderMarketMap, api config.APIConfig, ) (types.PriceAPIDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -53,24 +43,20 @@ func NewAPIHandler( } return &APIHandler{ - market: market, - api: api, + api: api, + cache: types.NewProviderTickers(), }, nil } // CreateURL returns the URL that is used to fetch data from the Binance API for the // given tickers. func (h *APIHandler) CreateURL( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) (string, error) { var tickerStrings string for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return "", fmt.Errorf("ticker %s not found in market config", ticker.String()) - } - - tickerStrings += fmt.Sprintf("%s%s%s%s", Quotation, market.OffChainTicker, Quotation, Separator) + tickerStrings += fmt.Sprintf("%s%s%s%s", Quotation, ticker.GetOffChainTicker(), Quotation, Separator) + h.cache.Add(ticker) } if len(tickerStrings) == 0 { @@ -88,13 +74,14 @@ func (h *APIHandler) CreateURL( // ParseResponse parses the response from the Binance API and returns a GetResponse. Each // of the tickers supplied will get a response or an error. func (h *APIHandler) ParseResponse( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, resp *http.Response, ) types.PriceResponse { // Parse the response into a BinanceResponse. result, err := Decode(resp) if err != nil { - return types.NewPriceResponseWithErr(tickers, + return types.NewPriceResponseWithErr( + tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode), ) } @@ -106,21 +93,21 @@ func (h *APIHandler) ParseResponse( for _, data := range result { // Filter out the responses that are not expected. - ticker, ok := h.market.OffChainMap[data.Symbol] + ticker, ok := h.cache.FromOffChainTicker(data.Symbol) if !ok { continue } - price, err := math.Float64StringToBigInt(data.Price, ticker.Decimals) + price, err := math.Float64StringToBigFloat(data.Price) if err != nil { - wErr := fmt.Errorf("failed to convert price %s to big.Int: %w", data.Price, err) + wErr := fmt.Errorf("failed to convert price %s to big.Float: %w", data.Price, err) unresolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(wErr, providertypes.ErrorFailedToParsePrice), } continue } - resolved[ticker] = types.NewPriceResult(price, time.Now()) + resolved[ticker] = types.NewPriceResult(price, time.Now().UTC()) } // Add currency pairs that received no response to the unresolved map. diff --git a/providers/apis/binance/api_handler_test.go b/providers/apis/binance/api_handler_test.go index 1140c9222..a14a9818a 100644 --- a/providers/apis/binance/api_handler_test.go +++ b/providers/apis/binance/api_handler_test.go @@ -14,51 +14,48 @@ import ( "github.com/skip-mev/slinky/providers/apis/binance" "github.com/skip-mev/slinky/providers/base/testutils" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -var mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) +var ( + btcusdt = binance.DefaultNonUSMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = binance.DefaultNonUSMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) +) func TestCreateURL(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker url string expectedErr bool }{ + { + name: "empty", + cps: []types.ProviderTicker{}, + url: "", + expectedErr: true, + }, { name: "valid single", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, url: "https://api.binance.com/api/v3/ticker/price?symbols=%5B%22BTCUSDT%22%5D", expectedErr: false, }, { name: "valid multiple", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, url: "https://api.binance.com/api/v3/ticker/price?symbols=%5B%22BTCUSDT%22,%22ETHUSDT%22%5D", expectedErr: false, }, - { - name: "unknown currency", - cps: []mmtypes.Ticker{ - mogusd, - }, - url: "", - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(binance.Name, binance.DefaultNonUSMarketConfig) - require.NoError(t, err) - - h, err := binance.NewAPIHandler(marketConfig, binance.DefaultNonUSAPIConfig) + h, err := binance.NewAPIHandler(binance.DefaultNonUSAPIConfig) require.NoError(t, err) url, err := h.CreateURL(tc.cps) @@ -75,43 +72,38 @@ func TestCreateURL(t *testing.T) { func TestCreateURL_US(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker url string expectedErr bool }{ + { + name: "empty", + cps: []types.ProviderTicker{}, + url: "", + expectedErr: true, + }, { name: "valid single", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, url: "https://api.binance.us/api/v3/ticker/price?symbols=%5B%22BTCUSDT%22%5D", expectedErr: false, }, { name: "valid multiple", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, url: "https://api.binance.us/api/v3/ticker/price?symbols=%5B%22BTCUSDT%22,%22ETHUSDT%22%5D", expectedErr: false, }, - { - name: "unknown currency", - cps: []mmtypes.Ticker{ - mogusd, - }, - url: "", - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(binance.Name, binance.DefaultUSMarketConfig) - require.NoError(t, err) - - h, err := binance.NewAPIHandler(marketConfig, binance.DefaultUSAPIConfig) + h, err := binance.NewAPIHandler(binance.DefaultUSAPIConfig) require.NoError(t, err) url, err := h.CreateURL(tc.cps) @@ -128,20 +120,22 @@ func TestCreateURL_US(t *testing.T) { func TestParseResponse(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker response *http.Response expected types.PriceResponse }{ { name: "valid single", - cps: []mmtypes.Ticker{constants.BITCOIN_USDT}, + cps: []types.ProviderTicker{ + btcusdt, + }, response: testutils.CreateResponseFromJSON( `[{"symbol":"BTCUSDT","price":"46707.03000000"}]`, ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(4670703000000), + btcusdt: { + Value: big.NewFloat(46707.03), }, }, types.UnResolvedPrices{}, @@ -149,46 +143,29 @@ func TestParseResponse(t *testing.T) { }, { name: "valid multiple", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, response: testutils.CreateResponseFromJSON( `[{"symbol":"BTCUSDT","price":"46707.03000000"},{"symbol":"ETHUSDT","price":"297.50000000"}]`, ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(4670703000000), + btcusdt: { + Value: big.NewFloat(46707.03), }, - constants.ETHEREUM_USDT: { - Value: big.NewInt(29750000000), + ethusdt: { + Value: big.NewFloat(297.5), }, }, types.UnResolvedPrices{}, ), }, - { - name: "unsupported currency", - cps: []mmtypes.Ticker{ - mogusd, - }, - response: testutils.CreateResponseFromJSON( - `[{"symbol":"MOGUSDT","price":"46707.03000000"}]`, - ), - expected: types.NewPriceResponse( - types.ResolvedPrices{}, - types.UnResolvedPrices{ - mogusd: providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), - }, - }, - ), - }, { name: "bad response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, response: testutils.CreateResponseFromJSON( `shout out my label thats me`, @@ -196,7 +173,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), }, }, @@ -204,8 +181,8 @@ func TestParseResponse(t *testing.T) { }, { name: "bad price response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, response: testutils.CreateResponseFromJSON( `[{"symbol":"BTCUSDT","price":"$46707.03000000"}]`, @@ -213,7 +190,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("invalid syntax"), providertypes.ErrorAPIGeneral), }, }, @@ -221,9 +198,9 @@ func TestParseResponse(t *testing.T) { }, { name: "no response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, response: testutils.CreateResponseFromJSON( `[]`, @@ -231,10 +208,10 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), }, - constants.ETHEREUM_USDT: providertypes.UnresolvedResult{ + ethusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), }, }, @@ -244,10 +221,11 @@ func TestParseResponse(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(binance.Name, binance.DefaultUSMarketConfig) + h, err := binance.NewAPIHandler(binance.DefaultNonUSAPIConfig) require.NoError(t, err) - h, err := binance.NewAPIHandler(marketConfig, binance.DefaultNonUSAPIConfig) + // Update the cache since it is assumed that createURL is executed before ParseResponse. + _, err = h.CreateURL(tc.cps) require.NoError(t, err) now := time.Now() @@ -259,7 +237,7 @@ func TestParseResponse(t *testing.T) { for cp, result := range tc.expected.Resolved { require.Contains(t, resp.Resolved, cp) r := resp.Resolved[cp] - require.Equal(t, result.Value, r.Value) + require.Equal(t, result.Value.SetPrec(18), r.Value.SetPrec(18)) require.True(t, r.Timestamp.After(now)) } diff --git a/providers/apis/binance/utils.go b/providers/apis/binance/utils.go index 3fb594adc..aec9449e7 100644 --- a/providers/apis/binance/utils.go +++ b/providers/apis/binance/utils.go @@ -61,305 +61,231 @@ var ( } // DefaultUSMarketConfig is the default US market configuration for Binance. - DefaultUSMarketConfig = types.TickerToProviderConfig{ + DefaultUSMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USDT: { - Name: Name, OffChainTicker: "APEUSDT", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APTUSDT", }, constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARBUSDT", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOMUSDT", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAXUSDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCHUSDT", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTCUSDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTCUSDT", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADAUSDT", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINKUSDT", }, constants.COMPOUND_USDT: { - Name: Name, OffChainTicker: "COMPUSDT", }, constants.CURVE_USDT: { - Name: Name, OffChainTicker: "CRVUSDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGEUSDT", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "ETCUSDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETHBTC", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETHUSDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETHUSDT", }, constants.FILECOIN_USDT: { - Name: Name, OffChainTicker: "FILUSDT", }, constants.LIDO_USDT: { - Name: Name, OffChainTicker: "LDOUSDT", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTCUSDT", }, constants.MAKER_USDT: { - Name: Name, OffChainTicker: "MKRUSDT", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "NEARUSDT", }, constants.OPTIMISM_USDT: { - Name: Name, OffChainTicker: "OPUSDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOTUSDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRPUSDT", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "SEIUSDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIBUSDT", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOLUSDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOLUSDT", }, constants.STELLAR_USDT: { - Name: Name, OffChainTicker: "XLMUSDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUIUSDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRXUSDT", }, constants.UNISWAP_USDT: { - Name: Name, OffChainTicker: "UNIUSDT", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDCUSDT", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLDUSDT", }, } // DefaultNonUSMarketConfig is the default market configuration for Binance. - DefaultNonUSMarketConfig = types.TickerToProviderConfig{ + DefaultNonUSMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USDT: { - Name: Name, OffChainTicker: "APEUSDT", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APTUSDT", }, constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARBUSDT", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOMUSDT", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAXUSDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCHUSDT", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTCUSDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTCUSDT", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADAUSDT", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINKUSDT", }, constants.COMPOUND_USDT: { - Name: Name, OffChainTicker: "COMPUSDT", }, constants.CURVE_USDT: { - Name: Name, OffChainTicker: "CRVUSDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGEUSDT", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDXUSDT", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "ETCUSDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETHBTC", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETHUSDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETHUSDT", }, constants.FILECOIN_USDT: { - Name: Name, OffChainTicker: "FILUSDT", }, constants.LIDO_USDT: { - Name: Name, OffChainTicker: "LDOUSDT", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTCUSDT", }, constants.MAKER_USDT: { - Name: Name, OffChainTicker: "MKRUSDT", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "NEARUSDT", }, constants.OPTIMISM_USDT: { - Name: Name, OffChainTicker: "OPUSDT", }, constants.PEPE_USDT: { - Name: Name, OffChainTicker: "PEPEUSDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOTUSDT", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATICUSDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRPUSDT", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "SEIUSDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIBUSDT", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOLUSDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOLUSDT", }, constants.STELLAR_USDT: { - Name: Name, OffChainTicker: "XLMUSDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUIUSDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRXUSDT", }, constants.UNISWAP_USDT: { - Name: Name, OffChainTicker: "UNIUSDT", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDCUSDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDTUSD", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLDUSDT", }, } diff --git a/providers/apis/coinbase/api_handler.go b/providers/apis/coinbase/api_handler.go index 806ab6bb0..7894a6ea0 100644 --- a/providers/apis/coinbase/api_handler.go +++ b/providers/apis/coinbase/api_handler.go @@ -11,7 +11,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/pkg/math" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIDataHandler = (*APIHandler)(nil) @@ -20,25 +19,14 @@ var _ types.PriceAPIDataHandler = (*APIHandler)(nil) // by a base provider. The DataHandler fetches data from the spot price Coinbase API. It is // atomic in that it must request data from the Coinbase API sequentially for each ticker. type APIHandler struct { - // market is the config for the Coinbase API. - market types.ProviderMarketMap // api is the config for the Coinbase API. api config.APIConfig } // NewAPIHandler returns a new Coinbase PriceAPIDataHandler. func NewAPIHandler( - market types.ProviderMarketMap, api config.APIConfig, ) (types.PriceAPIDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -52,8 +40,7 @@ func NewAPIHandler( } return &APIHandler{ - market: market, - api: api, + api: api, }, nil } @@ -62,63 +49,52 @@ func NewAPIHandler( // ticker at a time, this function will return an error if the ticker slice contains more // than one ticker. func (h *APIHandler) CreateURL( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) (string, error) { if len(tickers) != 1 { return "", fmt.Errorf("expected 1 ticker, got %d", len(tickers)) } - - // Ensure that the base and quote currencies are supported by the Coinbase API and - // are configured for the handler. - ticker := tickers[0] - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return "", fmt.Errorf("unknown ticker %s", ticker.String()) - } - - return fmt.Sprintf(h.api.URL, market.OffChainTicker), nil + return fmt.Sprintf(h.api.URL, tickers[0].GetOffChainTicker()), nil } // ParseResponse parses the spot price HTTP response from the Coinbase API and returns // the resulting price. Note that this can only parse a single ticker at a time. func (h *APIHandler) ParseResponse( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, resp *http.Response, ) types.PriceResponse { if len(tickers) != 1 { - return types.NewPriceResponseWithErr(tickers, - providertypes.NewErrorWithCode(fmt.Errorf("expected 1 ticker, got %d", len(tickers)), providertypes.ErrorInvalidResponse), - ) - } - - // Check if this ticker is supported by the Coinbase market config. - ticker := tickers[0] - _, ok := h.market.TickerConfigs[ticker] - if !ok { - return types.NewPriceResponseWithErr(tickers, - providertypes.NewErrorWithCode(fmt.Errorf("unknown ticker %s", ticker.String()), providertypes.ErrorUnknownPair), + return types.NewPriceResponseWithErr( + tickers, + providertypes.NewErrorWithCode( + fmt.Errorf("expected 1 ticker, got %d", len(tickers)), + providertypes.ErrorInvalidResponse, + ), ) } // Parse the response into a CoinBaseResponse. var result CoinBaseResponse if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { - return types.NewPriceResponseWithErr(tickers, + return types.NewPriceResponseWithErr( + tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode), ) } - // Convert the float64 price into a big.Int. - price, err := math.Float64StringToBigInt(result.Data.Amount, ticker.Decimals) + // Convert the float64 price into a big.Float. + ticker := tickers[0] + price, err := math.Float64StringToBigFloat(result.Data.Amount) if err != nil { - return types.NewPriceResponseWithErr(tickers, + return types.NewPriceResponseWithErr( + tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToParsePrice), ) } return types.NewPriceResponse( types.ResolvedPrices{ - ticker: types.NewPriceResult(price, time.Now()), + ticker: types.NewPriceResult(price, time.Now().UTC()), }, nil, ) diff --git a/providers/apis/coinbase/api_handler_test.go b/providers/apis/coinbase/api_handler_test.go index 0d59a97cc..b38d32071 100644 --- a/providers/apis/coinbase/api_handler_test.go +++ b/providers/apis/coinbase/api_handler_test.go @@ -15,39 +15,39 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/base/testutils" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -var mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) +var ( + btcusd = coinbase.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = coinbase.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) +) func TestCreateURL(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker url string expectedErr bool }{ + { + name: "empty", + cps: []types.ProviderTicker{}, + url: "", + expectedErr: true, + }, { name: "valid", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, url: "https://api.coinbase.com/v2/prices/BTC-USD/spot", expectedErr: false, }, { name: "multiple currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, - }, - url: "", - expectedErr: true, - }, - { - name: "unknown currency", - cps: []mmtypes.Ticker{ - mogusd, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, url: "", expectedErr: true, @@ -56,10 +56,7 @@ func TestCreateURL(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(coinbase.Name, coinbase.DefaultMarketConfig) - require.NoError(t, err) - - h, err := coinbase.NewAPIHandler(marketConfig, coinbase.DefaultAPIConfig) + h, err := coinbase.NewAPIHandler(coinbase.DefaultAPIConfig) require.NoError(t, err) url, err := h.CreateURL(tc.cps) @@ -76,14 +73,14 @@ func TestCreateURL(t *testing.T) { func TestParseResponse(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker response *http.Response expected types.PriceResponse }{ { name: "valid", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, response: testutils.CreateResponseFromJSON( ` @@ -97,8 +94,8 @@ func TestParseResponse(t *testing.T) { ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(102025000000), + btcusd: { + Value: big.NewFloat(1020.25), }, }, types.UnResolvedPrices{}, @@ -106,7 +103,9 @@ func TestParseResponse(t *testing.T) { }, { name: "malformed response", - cps: []mmtypes.Ticker{constants.BITCOIN_USD}, + cps: []types.ProviderTicker{ + btcusd, + }, response: testutils.CreateResponseFromJSON( ` { @@ -120,7 +119,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, }, @@ -128,7 +127,9 @@ func TestParseResponse(t *testing.T) { }, { name: "unable to parse float", - cps: []mmtypes.Ticker{constants.BITCOIN_USD}, + cps: []types.ProviderTicker{ + btcusd, + }, response: testutils.CreateResponseFromJSON( ` { @@ -142,7 +143,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, }, @@ -150,7 +151,7 @@ func TestParseResponse(t *testing.T) { }, { name: "unable to parse json", - cps: []mmtypes.Ticker{constants.BITCOIN_USD}, + cps: []types.ProviderTicker{btcusd}, response: testutils.CreateResponseFromJSON( ` toms obvious but not minimal language @@ -159,48 +160,17 @@ toms obvious but not minimal language expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, }, ), }, - { - name: "multiple currency pairs to parse response for", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, - }, - response: testutils.CreateResponseFromJSON( - ` -{ - "data": { - "amount": "1020.25", - "currency": "USD" - } -} - `, - ), - expected: types.NewPriceResponse( - types.ResolvedPrices{}, - types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("multiple cps"), providertypes.ErrorAPIGeneral), - }, - constants.ETHEREUM_USD: providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("multiple cps"), providertypes.ErrorAPIGeneral), - }, - }, - ), - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(coinbase.Name, coinbase.DefaultMarketConfig) - require.NoError(t, err) - - h, err := coinbase.NewAPIHandler(marketConfig, coinbase.DefaultAPIConfig) + h, err := coinbase.NewAPIHandler(coinbase.DefaultAPIConfig) require.NoError(t, err) now := time.Now() @@ -212,7 +182,7 @@ toms obvious but not minimal language for cp, result := range tc.expected.Resolved { require.Contains(t, resp.Resolved, cp) r := resp.Resolved[cp] - require.Equal(t, result.Value, r.Value) + require.Equal(t, result.Value.SetPrec(18), r.Value.SetPrec(18)) require.True(t, r.Timestamp.After(now)) } diff --git a/providers/apis/coinbase/utils.go b/providers/apis/coinbase/utils.go index 45daa460a..360dd78f8 100644 --- a/providers/apis/coinbase/utils.go +++ b/providers/apis/coinbase/utils.go @@ -35,229 +35,173 @@ var ( } // DefaultMarketConfig is the default market configuration for Coinbase. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USD: { - Name: Name, OffChainTicker: "APE-USD", }, constants.APE_USDC: { - Name: Name, OffChainTicker: "APE-USDC", }, constants.APE_USDT: { - Name: Name, OffChainTicker: "APE-USDT", }, constants.APTOS_USD: { - Name: Name, OffChainTicker: "APT-USD", }, constants.ARBITRUM_USD: { - Name: Name, OffChainTicker: "ARB-USD", }, constants.ATOM_USD: { - Name: Name, OffChainTicker: "ATOM-USD", }, constants.ATOM_USDC: { - Name: Name, OffChainTicker: "ATOM-USDC", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOM-USDT", }, constants.AVAX_USD: { - Name: Name, OffChainTicker: "AVAX-USD", }, constants.AVAX_USDC: { - Name: Name, OffChainTicker: "AVAX-USDC", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX-USDT", }, constants.BCH_USD: { - Name: Name, OffChainTicker: "BCH-USD", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "BTC-USD", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC-USDT", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTC-USDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC-USDT", }, constants.BLUR_USD: { - Name: Name, OffChainTicker: "BLUR-USD", }, constants.CARDANO_USD: { - Name: Name, OffChainTicker: "ADA-USD", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "TIA-USD", }, constants.CELESTIA_USDC: { - Name: Name, OffChainTicker: "TIA-USDC", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "TIA-USDT", }, constants.CHAINLINK_USD: { - Name: Name, OffChainTicker: "LINK-USD", }, constants.COMPOUND_USD: { - Name: Name, OffChainTicker: "COMP-USD", }, constants.CURVE_USD: { - Name: Name, OffChainTicker: "CRV-USD", }, constants.DOGE_USD: { - Name: Name, OffChainTicker: "DOGE-USD", }, constants.DYDX_USD: { - Name: Name, OffChainTicker: "DYDX-USD", }, constants.DYDX_USDC: { - Name: Name, OffChainTicker: "DYDX-USDC", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDX-USDT", }, constants.ETC_USD: { - Name: Name, OffChainTicker: "ETC-USD", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH-BTC", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ETH-USD", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETH-USDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH-USDT", }, constants.FILECOIN_USD: { - Name: Name, OffChainTicker: "FIL-USD", }, constants.LIDO_USD: { - Name: Name, OffChainTicker: "LDO-USD", }, constants.LITECOIN_USD: { - Name: Name, OffChainTicker: "LTC-USD", }, constants.MAKER_USD: { - Name: Name, OffChainTicker: "MKR-USD", }, constants.NEAR_USD: { - Name: Name, OffChainTicker: "NEAR-USD", }, constants.OPTIMISM_USD: { - Name: Name, OffChainTicker: "OP-USD", }, constants.OSMOSIS_USD: { - Name: Name, OffChainTicker: "OSMO-USD", }, constants.OSMOSIS_USDC: { - Name: Name, OffChainTicker: "OSMO-USDC", }, constants.OSMOSIS_USDT: { - Name: Name, OffChainTicker: "OSMO-USDT", }, constants.POLKADOT_USD: { - Name: Name, OffChainTicker: "DOT-USD", }, constants.POLYGON_USD: { - Name: Name, OffChainTicker: "MATIC-USD", }, constants.RIPPLE_USD: { - Name: Name, OffChainTicker: "XRP-USD", }, constants.SEI_USD: { - Name: Name, OffChainTicker: "SEI-USD", }, constants.SHIBA_USD: { - Name: Name, OffChainTicker: "SHIB-USD", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOL-USD", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOL-USDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL-USDT", }, constants.STELLAR_USD: { - Name: Name, OffChainTicker: "XLM-USD", }, constants.SUI_USD: { - Name: Name, OffChainTicker: "SUI-USD", }, constants.UNISWAP_USD: { - Name: Name, OffChainTicker: "UNI-USD", }, constants.USDC_USD: { - Name: Name, OffChainTicker: "USDC-USD", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDC-USDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDT-USD", }, } diff --git a/providers/apis/coingecko/api_handler.go b/providers/apis/coingecko/api_handler.go index ac73f4f68..849fd12ba 100644 --- a/providers/apis/coingecko/api_handler.go +++ b/providers/apis/coingecko/api_handler.go @@ -3,6 +3,7 @@ package coingecko import ( "encoding/json" "fmt" + "math/big" "net/http" "time" @@ -10,33 +11,22 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIDataHandler = (*APIHandler)(nil) // APIHandler implements the PriceAPIDataHandler interface for CoinGecko. type APIHandler struct { - // marketCfg is the config for the CoinGecko API. - market types.ProviderMarketMap // apiCfg is the config for the CoinGecko API. api config.APIConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewAPIHandler returns a new CoinGecko PriceAPIDataHandler. func NewAPIHandler( - market types.ProviderMarketMap, api config.APIConfig, ) (types.PriceAPIDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -50,8 +40,8 @@ func NewAPIHandler( } return &APIHandler{ - market: market, - api: api, + api: api, + cache: types.NewProviderTickers(), }, nil } @@ -59,7 +49,7 @@ func NewAPIHandler( // given tickers. The CoinGecko API supports fetching spot prices for multiple tickers // in a single request. func (h *APIHandler) CreateURL( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) (string, error) { // Create a list of base currencies and quote currencies. bases, quotes, err := h.getUniqueBaseAndQuoteDenoms(tickers) @@ -81,13 +71,16 @@ func (h *APIHandler) CreateURL( // out the responses that are not expected. Note that the response will only return // a response for the inputted tickers. func (h *APIHandler) ParseResponse( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, resp *http.Response, ) types.PriceResponse { // Parse the response. var result CoinGeckoResponse if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { - return types.NewPriceResponseWithErr(tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode)) + return types.NewPriceResponseWithErr( + tickers, + providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode), + ) } var ( @@ -102,14 +95,16 @@ func (h *APIHandler) ParseResponse( offChainTicker := fmt.Sprintf("%s%s%s", base, TickerSeparator, quote) // If the ticker is not configured, we skip it. - ticker, ok := h.market.OffChainMap[offChainTicker] + ticker, ok := h.cache.FromOffChainTicker(offChainTicker) if !ok { continue } // Resolve the price. - price := math.Float64ToBigInt(price, ticker.Decimals) - resolved[ticker] = types.NewPriceResult(price, time.Now()) + resolved[ticker] = types.NewPriceResult( + big.NewFloat(price), + time.Now().UTC(), + ) } } @@ -117,9 +112,8 @@ func (h *APIHandler) ParseResponse( // map. for _, ticker := range tickers { if _, resolvedOk := resolved[ticker]; !resolvedOk { - err := fmt.Errorf("no response") unresolved[ticker] = providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorNoResponse), + ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorNoResponse), } } } diff --git a/providers/apis/coingecko/api_handler_test.go b/providers/apis/coingecko/api_handler_test.go index 4f590fe36..18d5f280e 100644 --- a/providers/apis/coingecko/api_handler_test.go +++ b/providers/apis/coingecko/api_handler_test.go @@ -15,81 +15,53 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/apis/coingecko" "github.com/skip-mev/slinky/providers/base/testutils" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) - btcmog = mmtypes.NewTicker("BTC", "MOG", 8, 1) + btcusd = coingecko.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = coingecko.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) + ethbtc = coingecko.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_BITCOIN) ) func TestCreateURL(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker url string expectedErr bool }{ { name: "single valid currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, url: "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd&precision=18", expectedErr: false, }, { name: "multiple valid currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, url: "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd&precision=18", expectedErr: false, }, { name: "multiple valid currency pairs with multiple quotes", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, - constants.ETHEREUM_BITCOIN, + cps: []types.ProviderTicker{ + btcusd, + ethusd, + ethbtc, }, url: "https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd,btc&precision=18", expectedErr: false, }, - { - name: "no supported bases", - cps: []mmtypes.Ticker{ - mogusd, - }, - url: "", - expectedErr: true, - }, - { - name: "no supported quotes", - cps: []mmtypes.Ticker{ - btcmog, - }, - url: "", - expectedErr: true, - }, - { - name: "some supported and non-supported currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - mogusd, - }, - url: "", - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(coingecko.Name, coingecko.DefaultMarketConfig) - require.NoError(t, err) - - h, err := coingecko.NewAPIHandler(marketConfig, coingecko.DefaultAPIConfig) + h, err := coingecko.NewAPIHandler(coingecko.DefaultAPIConfig) require.NoError(t, err) url, err := h.CreateURL(tc.cps) @@ -106,14 +78,14 @@ func TestCreateURL(t *testing.T) { func TestParseResponse(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker response *http.Response expected types.PriceResponse }{ { name: "single valid currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, response: testutils.CreateResponseFromJSON( ` @@ -126,8 +98,8 @@ func TestParseResponse(t *testing.T) { ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(102025000000), + btcusd: { + Value: big.NewFloat(1020.25), }, }, types.UnResolvedPrices{}, @@ -135,8 +107,8 @@ func TestParseResponse(t *testing.T) { }, { name: "single valid currency pair that did not get a price response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, response: testutils.CreateResponseFromJSON( ` @@ -150,7 +122,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("currency pair BITCOIN-USD did not get a response"), providertypes.ErrorWebSocketGeneral), }, }, @@ -158,8 +130,8 @@ func TestParseResponse(t *testing.T) { }, { name: "bad response", - cps: []mmtypes.Ticker{ - btcmog, + cps: []types.ProviderTicker{ + btcusd, }, response: testutils.CreateResponseFromJSON( ` @@ -169,7 +141,7 @@ shout out my label thats me expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - btcmog: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("json error"), providertypes.ErrorWebSocketGeneral), }, }, @@ -177,8 +149,8 @@ shout out my label thats me }, { name: "bad price response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, response: testutils.CreateResponseFromJSON( ` @@ -192,7 +164,7 @@ shout out my label thats me expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("invalid syntax"), providertypes.ErrorWebSocketGeneral), }, }, @@ -200,9 +172,9 @@ shout out my label thats me }, { name: "multiple bases with single quotes", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, response: testutils.CreateResponseFromJSON( ` @@ -218,11 +190,11 @@ shout out my label thats me ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(102025000000), + btcusd: { + Value: big.NewFloat(1020.25), }, - constants.ETHEREUM_USD: { - Value: big.NewInt(102000000000), + ethusd: { + Value: big.NewFloat(1020), }, }, types.UnResolvedPrices{}, @@ -230,9 +202,9 @@ shout out my label thats me }, { name: "single base with multiple quotes", - cps: []mmtypes.Ticker{ - constants.ETHEREUM_USD, - constants.ETHEREUM_BITCOIN, + cps: []types.ProviderTicker{ + ethusd, + ethbtc, }, response: testutils.CreateResponseFromJSON( ` @@ -246,11 +218,11 @@ shout out my label thats me ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.ETHEREUM_USD: { - Value: big.NewInt(102025000000), + ethusd: { + Value: big.NewFloat(1020.25), }, - constants.ETHEREUM_BITCOIN: { - Value: big.NewInt(100000000), + ethbtc: { + Value: big.NewFloat(1), }, }, types.UnResolvedPrices{}, @@ -260,10 +232,11 @@ shout out my label thats me for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(coingecko.Name, coingecko.DefaultMarketConfig) + h, err := coingecko.NewAPIHandler(coingecko.DefaultAPIConfig) require.NoError(t, err) - h, err := coingecko.NewAPIHandler(marketConfig, coingecko.DefaultAPIConfig) + // Update the cache since it is assumed that createURL is executed before ParseResponse. + _, err = h.CreateURL(tc.cps) require.NoError(t, err) now := time.Now() @@ -275,7 +248,7 @@ shout out my label thats me for cp, result := range tc.expected.Resolved { require.Contains(t, resp.Resolved, cp) r := resp.Resolved[cp] - require.Equal(t, result.Value, r.Value) + require.Equal(t, result.Value.SetPrec(18), r.Value.SetPrec(18)) require.True(t, r.Timestamp.After(now)) } diff --git a/providers/apis/coingecko/utils.go b/providers/apis/coingecko/utils.go index 8407a8291..9a73f4156 100644 --- a/providers/apis/coingecko/utils.go +++ b/providers/apis/coingecko/utils.go @@ -8,7 +8,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/constants" "github.com/skip-mev/slinky/oracle/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) // NOTE: All documentation for this file can be located on the CoinGecko @@ -54,37 +53,29 @@ var ( } // DefaultMarketConfig is the default market configuration for CoinGecko. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.ATOM_USD: { - Name: Name, OffChainTicker: "cosmos/usd", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "bitcoin/usd", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "celestia/usd", }, constants.DYDX_USD: { - Name: Name, OffChainTicker: "dydx-chain/usd", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ethereum/btc", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ethereum/usd", }, constants.OSMOSIS_USD: { - Name: Name, OffChainTicker: "osmosis/usd", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "solana/usd", }, } @@ -110,7 +101,7 @@ type ( // from a list of tickers. Note that this function will only return the denoms // that are configured for the handler. If any of the tickers are not configured, // they will not be fetched. -func (h *APIHandler) getUniqueBaseAndQuoteDenoms(tickers []mmtypes.Ticker) (string, string, error) { +func (h *APIHandler) getUniqueBaseAndQuoteDenoms(tickers []types.ProviderTicker) (string, string, error) { if len(tickers) == 0 { return "", "", fmt.Errorf("no tickers specified") } @@ -125,13 +116,8 @@ func (h *APIHandler) getUniqueBaseAndQuoteDenoms(tickers []mmtypes.Ticker) (stri // Iterate through every currency pair and add the base and quote to the // unique bases and quotes list as long as they are supported. for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return "", "", fmt.Errorf("ticker %s is not supported", ticker.String()) - } - // Split the market ticker into the base and quote currencies. - split := strings.Split(market.OffChainTicker, TickerSeparator) + split := strings.Split(ticker.GetOffChainTicker(), TickerSeparator) if len(split) != 2 { return "", "", fmt.Errorf("ticker %s is not formatted correctly", ticker.String()) } @@ -147,6 +133,8 @@ func (h *APIHandler) getUniqueBaseAndQuoteDenoms(tickers []mmtypes.Ticker) (stri seenQuotes[quote] = struct{}{} quotes = append(quotes, quote) } + + h.cache.Add(ticker) } // If there are no bases or quotes, then none of the tickers are supported. diff --git a/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go b/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go index e8d6145cb..a2aacdaa4 100644 --- a/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go +++ b/providers/apis/defi/raydium/mocks/solana_jsonrpc_client.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package mocks diff --git a/providers/apis/defi/raydium/price_fetcher.go b/providers/apis/defi/raydium/price_fetcher.go index b94ac998d..69d66af2f 100644 --- a/providers/apis/defi/raydium/price_fetcher.go +++ b/providers/apis/defi/raydium/price_fetcher.go @@ -15,9 +15,7 @@ import ( "github.com/skip-mev/slinky/oracle/config" oracletypes "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/pkg/math" - oraclemath "github.com/skip-mev/slinky/pkg/math/oracle" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ oracletypes.PriceAPIFetcher = (*APIPriceFetcher)(nil) @@ -37,9 +35,6 @@ type SolanaJSONRPCClient interface { // APIPriceFetcher is responsible for interacting with the solana API and querying information // about the price of a given currency pair. type APIPriceFetcher struct { - // market represents the ticker configurations for this provider. - markets oracletypes.ProviderMarketMap - // config is the APIConfiguration for this provider config config.APIConfig @@ -56,7 +51,6 @@ type APIPriceFetcher struct { // NewAPIPriceFetcher returns a new APIPriceFetcher. This method constructs the // default solana JSON-RPC client in accordance with the config's URL param. func NewAPIPriceFetcher( - market oracletypes.ProviderMarketMap, config config.APIConfig, logger *zap.Logger, opts ...Option, @@ -76,7 +70,6 @@ func NewAPIPriceFetcher( } return NewAPIPriceFetcherWithClient( - market, config, rpc.New(config.URL), logger, @@ -88,7 +81,6 @@ func NewAPIPriceFetcher( // that the given market + config are valid, otherwise a nil implementation + an error // will be returned. func NewAPIPriceFetcherWithClient( - markets oracletypes.ProviderMarketMap, config config.APIConfig, client SolanaJSONRPCClient, logger *zap.Logger, @@ -98,43 +90,20 @@ func NewAPIPriceFetcherWithClient( return nil, fmt.Errorf("config for raydium is invalid: %w", err) } - if err := markets.ValidateBasic(); err != nil { - return nil, fmt.Errorf("market config for raydium is invalid: %w", err) - } - // check fields of config if config.Name != Name { return nil, fmt.Errorf("configured name is incorrect; expected: %s, got: %s", Name, config.Name) } - if markets.Name != Name { - return nil, fmt.Errorf("market config name is incorrect; expected: %s, got: %s", Name, markets.Name) - } - if !config.Enabled { return nil, fmt.Errorf("config is not enabled") } // generate metadata per ticker - metadataPerTicker := make(map[string]TickerMetadata) - for _, ticker := range markets.OffChainMap { - metadata, err := unmarshalMetadataJSON(ticker.Metadata_JSON) - if err != nil { - return nil, fmt.Errorf("error unmarshalling metadata for ticker %s: %w", ticker.String(), err) - } - - if err := metadata.ValidateBasic(); err != nil { - return nil, fmt.Errorf("metadata for ticker %s is invalid: %w", ticker.String(), err) - } - - metadataPerTicker[ticker.String()] = metadata - } - pf := &APIPriceFetcher{ - markets: markets, config: config, client: client, - metaDataPerTicker: metadataPerTicker, + metaDataPerTicker: make(map[string]TickerMetadata), logger: logger.With(zap.String("raydium_api_price_fetcher", Name)), } @@ -152,16 +121,16 @@ func NewAPIPriceFetcherWithClient( // - Calculate the price as quote / base, and scale by ticker.Decimals func (pf *APIPriceFetcher) Fetch( ctx context.Context, - tickers []mmtypes.Ticker, -) providertypes.GetResponse[mmtypes.Ticker, *big.Int] { + tickers []oracletypes.ProviderTicker, +) oracletypes.PriceResponse { // get the acounts to query in order of the tickers given expectedNumAccounts := len(tickers) * 2 accounts := make([]solana.PublicKey, expectedNumAccounts) for i, ticker := range tickers { - metadata, ok := pf.metaDataPerTicker[ticker.String()] - if !ok { - return providertypes.NewGetResponseWithErr[mmtypes.Ticker, *big.Int]( + metadata, err := pf.updateMetaDataCache(ticker) + if err != nil { + return oracletypes.NewPriceResponseWithErr( tickers, providertypes.NewErrorWithCode( NoRaydiumMetadataForTickerError(ticker.String()), @@ -186,7 +155,7 @@ func (pf *APIPriceFetcher) Fetch( // TODO(nikhil): Keep track of latest height queried as well? }) if err != nil { - return providertypes.NewGetResponseWithErr[mmtypes.Ticker, *big.Int]( + return oracletypes.NewPriceResponseWithErr( tickers, providertypes.NewErrorWithCode( SolanaJSONRPCError(err), @@ -197,7 +166,7 @@ func (pf *APIPriceFetcher) Fetch( // expect a base / quote vault account for each ticker queried if len(accountsResp.Value) != expectedNumAccounts { - return providertypes.NewGetResponseWithErr[mmtypes.Ticker, *big.Int]( + return oracletypes.NewPriceResponseWithErr( tickers, providertypes.NewErrorWithCode( SolanaJSONRPCError(fmt.Errorf("expected %d accounts, got %d", expectedNumAccounts, len(accountsResp.Value))), @@ -215,7 +184,7 @@ func (pf *APIPriceFetcher) Fetch( metadata := pf.metaDataPerTicker[ticker.String()] // parse the token balances - baseTokenBalance, err := getScaledTokenBalance(baseAccount, metadata.BaseTokenVault.TokenDecimals) + baseTokenBalance, err := getScaledTokenBalance(baseAccount) if err != nil { pf.logger.Debug("error getting base token balance", zap.Error(err)) unresolved[ticker] = providertypes.UnresolvedResult{ @@ -227,7 +196,7 @@ func (pf *APIPriceFetcher) Fetch( continue } - quoteTokenBalance, err := getScaledTokenBalance(quoteAccount, metadata.QuoteTokenVault.TokenDecimals) + quoteTokenBalance, err := getScaledTokenBalance(quoteAccount) if err != nil { pf.logger.Debug("error getting quote token balance", zap.Error(err)) unresolved[ticker] = providertypes.UnresolvedResult{ @@ -239,19 +208,32 @@ func (pf *APIPriceFetcher) Fetch( continue } - pf.logger.Debug("balances", zap.String("base", baseTokenBalance.String()), zap.String("quote", quoteTokenBalance.String())) + pf.logger.Debug( + "unscaled balances", + zap.String("base", baseTokenBalance.String()), + zap.String("quote", quoteTokenBalance.String()), + ) // calculate the price - price := calculatePrice(baseTokenBalance, quoteTokenBalance, ticker.Decimals) + price := calculatePrice( + baseTokenBalance, quoteTokenBalance, + metadata.BaseTokenVault.TokenDecimals, metadata.QuoteTokenVault.TokenDecimals, + ) + + pf.logger.Debug( + "scaled price", + zap.String("ticker", ticker.String()), + zap.String("price", price.String()), + ) // return the price - resolved[ticker] = oracletypes.NewPriceResult(price, time.Now()) + resolved[ticker] = oracletypes.NewPriceResult(price, time.Now().UTC()) } return oracletypes.NewPriceResponse(resolved, unresolved) } -func getScaledTokenBalance(account *rpc.Account, tokenDecimals uint64) (*big.Int, error) { +func getScaledTokenBalance(account *rpc.Account) (*big.Int, error) { // if the account is nil, return error if account == nil { return nil, fmt.Errorf("account is nil") @@ -270,13 +252,20 @@ func getScaledTokenBalance(account *rpc.Account, tokenDecimals uint64) (*big.Int // get the token balance + scale by decimals balance := new(big.Int).SetUint64(tokenAccount.Amount) - return oraclemath.ScaleUpCurrencyPairPrice(tokenDecimals, balance) + return balance, nil } -func calculatePrice(baseTokenBalance, quoteTokenBalance *big.Int, decimals uint64) *big.Int { +func calculatePrice( + baseTokenBalance, quoteTokenBalance *big.Int, + baseTokenDecimals, quoteTokenDecimals uint64, +) *big.Float { + scalingFactor := math.GetScalingFactor(int64(baseTokenDecimals), int64(quoteTokenDecimals)) + // calculate the price as quote / base - price := new(big.Float).Quo(new(big.Float).SetInt(quoteTokenBalance), new(big.Float).SetInt(baseTokenBalance)) + quo := new(big.Float).Quo( + new(big.Float).SetInt(quoteTokenBalance), + new(big.Float).SetInt(baseTokenBalance), + ) - // scale by the ticker decimals - return math.BigFloatToBigInt(price, decimals) + return new(big.Float).Mul(quo, scalingFactor) } diff --git a/providers/apis/defi/raydium/price_fetcher_test.go b/providers/apis/defi/raydium/price_fetcher_test.go index 3b5172a08..9a366438a 100644 --- a/providers/apis/defi/raydium/price_fetcher_test.go +++ b/providers/apis/defi/raydium/price_fetcher_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "fmt" + "math/big" "strings" "testing" "time" @@ -18,11 +19,9 @@ import ( "go.uber.org/zap" oracleconfig "github.com/skip-mev/slinky/oracle/config" - oracletypes "github.com/skip-mev/slinky/oracle/types" - slinkytypes "github.com/skip-mev/slinky/pkg/types" + "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/apis/defi/raydium" "github.com/skip-mev/slinky/providers/apis/defi/raydium/mocks" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) const ( @@ -105,7 +104,6 @@ func TestProviderInit(t *testing.T) { } _, err := raydium.NewAPIPriceFetcher( - oracletypes.ProviderMarketMap{}, cfg, zap.NewNop(), ) @@ -113,32 +111,6 @@ func TestProviderInit(t *testing.T) { require.True(t, strings.Contains(err.Error(), "config for raydium is invalid")) }) - t.Run("market config fails validate basic", func(t *testing.T) { - // valid config - cfg := oracleconfig.APIConfig{ - Enabled: false, - MaxQueries: 2, - Interval: 1 * time.Second, - Timeout: 2 * time.Second, - ReconnectTimeout: 2 * time.Second, - } - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name, - OffChainMap: map[string]mmtypes.Ticker{ - "BTC/USDC": { - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - }, - }, - } - - _, err := raydium.NewAPIPriceFetcher( - market, - cfg, - zap.NewNop(), - ) - require.True(t, strings.Contains(err.Error(), "market config for raydium is invalid")) - }) - t.Run("incorrect provider name", func(t *testing.T) { cfg := oracleconfig.APIConfig{ Enabled: true, @@ -149,36 +121,12 @@ func TestProviderInit(t *testing.T) { URL: "https://api.raydium.io", Name: raydium.Name + "a", } - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name + "a", - } _, err := raydium.NewAPIPriceFetcher( - market, cfg, zap.NewNop(), ) require.Equal(t, err.Error(), fmt.Sprintf("configured name is incorrect; expected: %s, got: %s", raydium.Name, raydium.Name+"a")) - - cfg = oracleconfig.APIConfig{ - Enabled: true, - MaxQueries: 2, - Interval: 1 * time.Second, - Timeout: 2 * time.Second, - ReconnectTimeout: 2 * time.Second, - URL: "https://api.raydium.io", - Name: raydium.Name, - } - market = oracletypes.ProviderMarketMap{ - Name: raydium.Name + "a", - } - - _, err = raydium.NewAPIPriceFetcher( - market, - cfg, - zap.NewNop(), - ) - require.Equal(t, err.Error(), fmt.Sprintf("market config name is incorrect; expected: %s, got: %s", raydium.Name, raydium.Name+"a")) }) t.Run("api not enabled", func(t *testing.T) { @@ -190,177 +138,13 @@ func TestProviderInit(t *testing.T) { ReconnectTimeout: 2 * time.Second, Name: raydium.Name, } - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name, - } _, err := raydium.NewAPIPriceFetcher( - market, cfg, zap.NewNop(), ) require.Error(t, err, "config is not enabled") }) - - t.Run("unmarshalling metadata json for tickers fails", func(t *testing.T) { - cfg := oracleconfig.APIConfig{ - Enabled: true, - MaxQueries: 2, - Interval: 1 * time.Second, - Timeout: 2 * time.Second, - ReconnectTimeout: 2 * time.Second, - Name: raydium.Name, - URL: "https://raydium.io", - } - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name, - TickerConfigs: oracletypes.TickerToProviderConfig{ - mmtypes.Ticker{ - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: `{ - "base_token_vault": ["base_token_vault_address"] - }`, - }: { - OffChainTicker: "BTC/USDC", - Name: raydium.Name, - }, - }, - OffChainMap: map[string]mmtypes.Ticker{ - "BTC/USDC": { - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: `{ - "base_token_vault": ["base_token_vault_address"] - }`, - }, - }, - } - - _, err := raydium.NewAPIPriceFetcher( - market, - cfg, - zap.NewNop(), - ) - t.Log(err) - require.True(t, strings.Contains(err.Error(), fmt.Sprintf("error unmarshalling metadata for ticker %s", slinkytypes.NewCurrencyPair("BTC", "USDC")))) - }) - - t.Run("invalid metadata json in config", func(t *testing.T) { - cfg := oracleconfig.APIConfig{ - Enabled: true, - MaxQueries: 2, - Interval: 1 * time.Second, - Timeout: 2 * time.Second, - ReconnectTimeout: 2 * time.Second, - Name: raydium.Name, - URL: "https://raydium.io", - } - - bz, err := json.Marshal(raydium.TickerMetadata{ - BaseTokenVault: raydium.AMMTokenVaultMetadata{ - TokenVaultAddress: "abc", - }, - }) - require.NoError(t, err) - - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name, - TickerConfigs: oracletypes.TickerToProviderConfig{ - mmtypes.Ticker{ - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: string(bz), - }: { - OffChainTicker: "BTC/USDC", - Name: raydium.Name, - }, - }, - OffChainMap: map[string]mmtypes.Ticker{ - "BTC/USDC": { - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: string(bz), - }, - }, - } - - _, err = raydium.NewAPIPriceFetcher( - market, - cfg, - zap.NewNop(), - ) - t.Log(err) - require.True(t, strings.Contains(err.Error(), fmt.Sprintf("metadata for ticker %s is invalid", slinkytypes.NewCurrencyPair("BTC", "USDC")))) - }) - - t.Run("correctly unmarshals metadata json for ticker", func(t *testing.T) { - cfg := oracleconfig.APIConfig{ - Enabled: true, - MaxQueries: 2, - Interval: 1 * time.Second, - Timeout: 2 * time.Second, - ReconnectTimeout: 2 * time.Second, - Name: raydium.Name, - Endpoints: []oracleconfig.Endpoint{ - { - URL: "https://raydium.io", - }, - }, - } - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name, - TickerConfigs: oracletypes.TickerToProviderConfig{ - mmtypes.Ticker{ - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: `{ - "base_token_vault": { - "token_vault_address": "` + USDCVaultAddress + `", - "token_vault_decimals": 6 - }, - "quote_token_vault": { - "token_vault_address": "` + BTCVaultAddress + `", - "token_vault_decimals": 8 - } - }`, - }: { - OffChainTicker: "BTC/USDC", - Name: raydium.Name, - }, - }, - OffChainMap: map[string]mmtypes.Ticker{ - "BTC/USDC": { - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: `{ - "base_token_vault": { - "token_vault_address": "` + USDCVaultAddress + `", - "token_vault_decimals": 6 - }, - "quote_token_vault": { - "token_vault_address": "` + BTCVaultAddress + `", - "token_vault_decimals": 8 - } - }`, - }, - }, - } - - _, err := raydium.NewAPIPriceFetcher( - market, - cfg, - zap.NewNop(), - ) - t.Log(err) - require.NoError(t, err) - }) } // Test getting prices. @@ -396,29 +180,23 @@ func TestProviderFetch(t *testing.T) { }, } - tickers := []mmtypes.Ticker{ + tickers := []types.DefaultProviderTicker{ { - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USDC"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: marshalDataToJSON(btcUSDCMetadata), + OffChainTicker: "BTC/USDC", + JSON: marshalDataToJSON(btcUSDCMetadata), }, { - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USDT"), - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: marshalDataToJSON(ethUSDTMetadata), + OffChainTicker: "ETH/USDT", + JSON: marshalDataToJSON(ethUSDTMetadata), }, { - CurrencyPair: slinkytypes.NewCurrencyPair("MOG", "SOL"), - Decimals: 18, - MinProviderCount: 1, - Metadata_JSON: marshalDataToJSON(mogSOLMetadata), + OffChainTicker: "MOG/SOL", + JSON: marshalDataToJSON(mogSOLMetadata), }, } client := mocks.NewSolanaJSONRPCClient(t) - pf, err := newPriceFetcherFromTickers(tickers, client) + pf, err := newPriceFetcher(client) require.NoError(t, err) t.Run("accounts resp returns len(tickers) * 2 accounts", func(t *testing.T) { @@ -435,7 +213,8 @@ func TestProviderFetch(t *testing.T) { &rpc.GetMultipleAccountsResult{}, nil, ).Once() - resp := pf.Fetch(ctx, tickers[:2]) + ts := defaultTickersToProviderTickers(tickers[:2]) + resp := pf.Fetch(ctx, ts) // expect a failed response require.Equal(t, len(resp.Resolved), 0) require.Equal(t, len(resp.UnResolved), 2) @@ -460,7 +239,8 @@ func TestProviderFetch(t *testing.T) { &rpc.GetMultipleAccountsResult{}, err, ).Once() - resp := pf.Fetch(ctx, tickers[:2]) + ts := defaultTickersToProviderTickers(tickers[:2]) + resp := pf.Fetch(ctx, ts) // expect a failed response require.Equal(t, len(resp.Resolved), 0) require.Equal(t, len(resp.UnResolved), 2) @@ -473,10 +253,12 @@ func TestProviderFetch(t *testing.T) { t.Run("unexpected ticker in query", func(t *testing.T) { ctx := context.Background() - resp := pf.Fetch(ctx, []mmtypes.Ticker{ - { - CurrencyPair: slinkytypes.NewCurrencyPair("MOG", "TIA"), - }, + mogtia := types.DefaultProviderTicker{ + OffChainTicker: "MOG/TIA", + JSON: "{}", + } + resp := pf.Fetch(ctx, []types.ProviderTicker{ + mogtia, }) // expect a failed response require.Equal(t, len(resp.Resolved), 0) @@ -545,7 +327,8 @@ func TestProviderFetch(t *testing.T) { }, nil, ) - resp := pf.Fetch(ctx, tickers[:3]) + ts := defaultTickersToProviderTickers(tickers[:3]) + resp := pf.Fetch(ctx, ts) // expect a failed response require.Equal(t, len(resp.Resolved), 1) @@ -553,7 +336,7 @@ func TestProviderFetch(t *testing.T) { require.True(t, strings.Contains(resp.UnResolved[tickers[0]].Error(), "solana json-rpc error")) result := resp.Resolved[tickers[1]] - require.Equal(t, result.Value.Uint64(), uint64(3e8)) + require.Equal(t, result.Value.SetPrec(30), big.NewFloat(3e-12).SetPrec(30)) }) t.Run("incorrectly encoded accounts are handled gracefully", func(t *testing.T) { @@ -578,7 +361,8 @@ func TestProviderFetch(t *testing.T) { }, nil, ) - resp := pf.Fetch(ctx, tickers[:1]) + ts := defaultTickersToProviderTickers(tickers[:1]) + resp := pf.Fetch(ctx, ts) // expect a failed response require.Equal(t, len(resp.Resolved), 0) @@ -596,7 +380,7 @@ func marshalDataToJSON(obj interface{}) string { return string(data) } -func newPriceFetcherFromTickers(tickers []mmtypes.Ticker, client *mocks.SolanaJSONRPCClient) (*raydium.APIPriceFetcher, error) { +func newPriceFetcher(client *mocks.SolanaJSONRPCClient) (*raydium.APIPriceFetcher, error) { cfg := oracleconfig.APIConfig{ Enabled: true, MaxQueries: 2, @@ -606,24 +390,18 @@ func newPriceFetcherFromTickers(tickers []mmtypes.Ticker, client *mocks.SolanaJS Name: raydium.Name, URL: "https://raydium.io", } - market := oracletypes.ProviderMarketMap{ - Name: raydium.Name, - TickerConfigs: make(oracletypes.TickerToProviderConfig), - OffChainMap: make(map[string]mmtypes.Ticker), - } - - for _, ticker := range tickers { - market.TickerConfigs[ticker] = mmtypes.ProviderConfig{ - Name: raydium.Name, - OffChainTicker: ticker.String(), - } - market.OffChainMap[ticker.String()] = ticker - } return raydium.NewAPIPriceFetcherWithClient( - market, cfg, client, zap.NewExample(), ) } + +func defaultTickersToProviderTickers(tickers []types.DefaultProviderTicker) []types.ProviderTicker { + providerTickers := make([]types.ProviderTicker, len(tickers)) + for i, ticker := range tickers { + providerTickers[i] = ticker + } + return providerTickers +} diff --git a/providers/apis/defi/raydium/types.go b/providers/apis/defi/raydium/types.go index bdbc309a7..3734ba6b0 100644 --- a/providers/apis/defi/raydium/types.go +++ b/providers/apis/defi/raydium/types.go @@ -7,7 +7,8 @@ import ( "github.com/gagliardetto/solana-go" - oracleconfig "github.com/skip-mev/slinky/oracle/config" + "github.com/skip-mev/slinky/oracle/config" + "github.com/skip-mev/slinky/oracle/types" ) const ( @@ -18,6 +19,25 @@ const ( NormalizedTokenAmountExponent = 18 ) +// updateMetaDataCache unmarshals the metadata JSON for each ticker and adds it to the +// metadata map. +func (pf *APIPriceFetcher) updateMetaDataCache(ticker types.ProviderTicker) (TickerMetadata, error) { + if metadata, ok := pf.metaDataPerTicker[ticker.GetJSON()]; ok { + return metadata, nil + } + + metadata, err := unmarshalMetadataJSON(ticker.GetJSON()) + if err != nil { + return TickerMetadata{}, fmt.Errorf("error unmarshalling metadata for ticker %s: %w", ticker.String(), err) + } + if err := metadata.ValidateBasic(); err != nil { + return TickerMetadata{}, fmt.Errorf("metadata for ticker %s is invalid: %w", ticker.String(), err) + } + pf.metaDataPerTicker[ticker.GetJSON()] = metadata + + return metadata, nil +} + // TickerMetadata represents the metadata associated with a ticker's corresponding // raydium pool. type TickerMetadata struct { @@ -76,7 +96,7 @@ func SolanaJSONRPCError(err error) error { return fmt.Errorf("solana json-rpc error: %s", err.Error()) } -var DefaultAPIConfig = oracleconfig.APIConfig{ +var DefaultAPIConfig = config.APIConfig{ Enabled: true, Name: Name, Timeout: 500 * time.Millisecond, diff --git a/providers/apis/defi/uniswapv3/fetcher.go b/providers/apis/defi/uniswapv3/fetcher.go index 043a787a7..90762026f 100644 --- a/providers/apis/defi/uniswapv3/fetcher.go +++ b/providers/apis/defi/uniswapv3/fetcher.go @@ -13,12 +13,11 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/rpc" + "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" uniswappool "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3/pool" - "github.com/skip-mev/slinky/providers/base/api/metrics" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIFetcher = (*PriceFetcher)(nil) @@ -34,9 +33,8 @@ var _ types.PriceAPIFetcher = (*PriceFetcher)(nil) // this is more performant than making individual calls or the multi call contract: // https://docs.chainstack.com/docs/http-batch-request-vs-multicall-contract#performance-comparison. type PriceFetcher struct { - logger *zap.Logger - metrics metrics.APIMetrics - api config.APIConfig + logger *zap.Logger + api config.APIConfig // client is the EVM client implementation. This is used to interact with the ethereum network. client EVMClient @@ -48,13 +46,12 @@ type PriceFetcher struct { payload []byte // poolCache is a cache of the tickers to pool configs. This is used to avoid unmarshalling // the metadata for each ticker. - poolCache map[mmtypes.Ticker]PoolConfig + poolCache map[types.ProviderTicker]PoolConfig } // NewPriceFetcher returns a new Uniswap V3 price fetcher. func NewPriceFetcher( logger *zap.Logger, - metrics metrics.APIMetrics, api config.APIConfig, client EVMClient, ) (*PriceFetcher, error) { @@ -62,10 +59,6 @@ func NewPriceFetcher( return nil, fmt.Errorf("logger cannot be nil") } - if metrics == nil { - return nil, fmt.Errorf("metrics cannot be nil") - } - if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -90,12 +83,11 @@ func NewPriceFetcher( return &PriceFetcher{ logger: logger, - metrics: metrics, api: api, client: client, abi: abi, payload: payload, - poolCache: make(map[mmtypes.Ticker]PoolConfig), + poolCache: make(map[types.ProviderTicker]PoolConfig), }, nil } @@ -105,13 +97,8 @@ func NewPriceFetcher( // contract, specifically the sqrtPriceX96 value. func (u *PriceFetcher) Fetch( ctx context.Context, - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) types.PriceResponse { - start := time.Now() - defer func() { - u.metrics.ObserveProviderResponseLatency(Name, time.Since(start)) - }() - var ( resolved = make(types.ResolvedPrices) unResolved = make(types.UnResolvedPrices) @@ -210,9 +197,8 @@ func (u *PriceFetcher) Fetch( price := ConvertSquareRootX96Price(sqrtPriceX96) // Scale the price to the respective token decimals. - scaledPrice := ScalePrice(ticker, pools[i], price) - intPrice, _ := scaledPrice.Int(nil) - resolved[ticker] = types.NewPriceResult(intPrice, time.Now()) + scaledPrice := ScalePrice(pools[i], price) + resolved[ticker] = types.NewPriceResult(scaledPrice, time.Now().UTC()) } // Add the price to the resolved prices. @@ -222,14 +208,14 @@ func (u *PriceFetcher) Fetch( // GetPool returns the uniswap pool for the given ticker. This will unmarshal the metadata // and validate the pool config which contains all required information to query the EVM. func (u *PriceFetcher) GetPool( - ticker mmtypes.Ticker, + ticker types.ProviderTicker, ) (PoolConfig, error) { if pool, ok := u.poolCache[ticker]; ok { return pool, nil } var cfg PoolConfig - if err := json.Unmarshal([]byte(ticker.Metadata_JSON), &cfg); err != nil { + if err := json.Unmarshal([]byte(ticker.GetJSON()), &cfg); err != nil { return cfg, fmt.Errorf("failed to unmarshal pool config on ticker: %w", err) } if err := cfg.ValidateBasic(); err != nil { diff --git a/providers/apis/defi/uniswapv3/fetcher_test.go b/providers/apis/defi/uniswapv3/fetcher_test.go index a26b77f9e..34e5ba836 100644 --- a/providers/apis/defi/uniswapv3/fetcher_test.go +++ b/providers/apis/defi/uniswapv3/fetcher_test.go @@ -7,69 +7,68 @@ import ( "testing" "github.com/ethereum/go-ethereum/rpc" + "github.com/stretchr/testify/require" + "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3/mocks" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" - "github.com/stretchr/testify/require" ) func TestFetch(t *testing.T) { testCases := []struct { name string - tickers []mmtypes.Ticker + tickers []types.ProviderTicker client func() uniswapv3.EVMClient expected types.PriceResponse }{ { name: "no tickers", - tickers: []mmtypes.Ticker{}, + tickers: []types.ProviderTicker{}, client: func() uniswapv3.EVMClient { c := mocks.NewEVMClient(t) c.On("BatchCallContext", context.Background(), []rpc.BatchElem{}).Return(nil) return c }, expected: types.PriceResponse{ - Resolved: map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int]{}, - UnResolved: map[mmtypes.Ticker]providertypes.UnresolvedResult{}, + Resolved: map[types.ProviderTicker]providertypes.ResolvedResult[*big.Float]{}, + UnResolved: map[types.ProviderTicker]providertypes.UnresolvedResult{}, }, }, { - name: "fails to retrieve pool for an empty ticker", - tickers: []mmtypes.Ticker{ - {}, + name: "fails to retrieve pool for an empty ticker", + tickers: []types.ProviderTicker{ + types.NewProviderTicker("WETH/USDC", ""), }, client: func() uniswapv3.EVMClient { return mocks.NewEVMClient(t) }, expected: types.PriceResponse{ - Resolved: map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int]{}, - UnResolved: map[mmtypes.Ticker]providertypes.UnresolvedResult{ - {}: {}, + Resolved: map[types.ProviderTicker]providertypes.ResolvedResult[*big.Float]{}, + UnResolved: map[types.ProviderTicker]providertypes.UnresolvedResult{ + types.NewProviderTicker("WETH/USDC", ""): {}, }, }, }, { name: "fails to make a batch call", - tickers: []mmtypes.Ticker{ - weth_usdc_ticker, + tickers: []types.ProviderTicker{ + wethusdcTicker, }, client: func() uniswapv3.EVMClient { return createEVMClientWithResponse(t, fmt.Errorf("failed to make a batch call"), nil, nil) }, expected: types.PriceResponse{ - Resolved: map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int]{}, - UnResolved: map[mmtypes.Ticker]providertypes.UnresolvedResult{ - weth_usdc_ticker: {}, + Resolved: map[types.ProviderTicker]providertypes.ResolvedResult[*big.Float]{}, + UnResolved: map[types.ProviderTicker]providertypes.UnresolvedResult{ + wethusdcTicker: {}, }, }, }, { name: "batch request has an error for a single ticker", - tickers: []mmtypes.Ticker{ - weth_usdc_ticker, + tickers: []types.ProviderTicker{ + wethusdcTicker, }, client: func() uniswapv3.EVMClient { batchErrors := []error{ @@ -81,16 +80,16 @@ func TestFetch(t *testing.T) { return createEVMClientWithResponse(t, nil, responses, batchErrors) }, expected: types.PriceResponse{ - Resolved: map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int]{}, - UnResolved: map[mmtypes.Ticker]providertypes.UnresolvedResult{ - weth_usdc_ticker: {}, + Resolved: map[types.ProviderTicker]providertypes.ResolvedResult[*big.Float]{}, + UnResolved: map[types.ProviderTicker]providertypes.UnresolvedResult{ + wethusdcTicker: {}, }, }, }, { name: "batch request returns a result that cannot be parsed", - tickers: []mmtypes.Ticker{ - weth_usdc_ticker, + tickers: []types.ProviderTicker{ + wethusdcTicker, }, client: func() uniswapv3.EVMClient { batchErrors := []error{ @@ -102,16 +101,16 @@ func TestFetch(t *testing.T) { return createEVMClientWithResponse(t, nil, responses, batchErrors) }, expected: types.PriceResponse{ - Resolved: map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int]{}, - UnResolved: map[mmtypes.Ticker]providertypes.UnresolvedResult{ - weth_usdc_ticker: {}, + Resolved: map[types.ProviderTicker]providertypes.ResolvedResult[*big.Float]{}, + UnResolved: map[types.ProviderTicker]providertypes.UnresolvedResult{ + wethusdcTicker: {}, }, }, }, { name: "weth/usdc mainnet result", - tickers: []mmtypes.Ticker{ - weth_usdc_ticker, + tickers: []types.ProviderTicker{ + wethusdcTicker, }, client: func() uniswapv3.EVMClient { batchErrors := []error{ @@ -123,17 +122,12 @@ func TestFetch(t *testing.T) { return createEVMClientWithResponse(t, nil, responses, batchErrors) }, expected: types.PriceResponse{ - Resolved: map[mmtypes.Ticker]providertypes.ResolvedResult[*big.Int]{ - weth_usdc_ticker: { - Value: func() *big.Int { - v, ok := new(big.Float).SetString("3.313131879703878971626114658316303e+21") - require.True(t, ok) - i, _ := v.Int(nil) - return i - }(), + Resolved: map[types.ProviderTicker]providertypes.ResolvedResult[*big.Float]{ + wethusdcTicker: { + Value: big.NewFloat(3313.131879703878971626114658316303), }, }, - UnResolved: map[mmtypes.Ticker]providertypes.UnresolvedResult{}, + UnResolved: map[types.ProviderTicker]providertypes.UnresolvedResult{}, }, }, } @@ -148,7 +142,7 @@ func TestFetch(t *testing.T) { for ticker, result := range tc.expected.Resolved { require.Contains(t, response.Resolved, ticker) - math.VerifyPrice(t, result.Value, response.Resolved[ticker].Value, acceptableDelta) + require.Equal(t, result.Value.SetPrec(40), response.Resolved[ticker].Value.SetPrec(40)) } for ticker := range tc.expected.UnResolved { @@ -162,7 +156,7 @@ func TestGetPool(t *testing.T) { fetcher := createPriceFetcher(t) t.Run("ticker is empty", func(t *testing.T) { - ticker := mmtypes.Ticker{} + ticker := types.NewProviderTicker("", "") _, err := fetcher.GetPool(ticker) require.Error(t, err) }) @@ -171,17 +165,13 @@ func TestGetPool(t *testing.T) { expected := uniswapv3.PoolConfig{ Address: "0x1234", } - ticker := mmtypes.Ticker{ - Metadata_JSON: expected.MustToJSON(), - } + ticker := types.NewProviderTicker("WETH/USDC", expected.MustToJSON()) _, err := fetcher.GetPool(ticker) require.Error(t, err) }) t.Run("ticker is not json formatted", func(t *testing.T) { - ticker := mmtypes.Ticker{ - Metadata_JSON: "not json, just a string", - } + ticker := types.NewProviderTicker("WETH/USDC", "not json, something else") _, err := fetcher.GetPool(ticker) require.Error(t, err) }) @@ -193,9 +183,7 @@ func TestGetPool(t *testing.T) { QuoteDecimals: 6, Invert: true, } - ticker := mmtypes.Ticker{ - Metadata_JSON: expected.MustToJSON(), - } + ticker := types.NewProviderTicker("WETH/USDC", expected.MustToJSON()) pool, err := fetcher.GetPool(ticker) require.NoError(t, err) require.Equal(t, expected, pool) diff --git a/providers/apis/defi/uniswapv3/helper_test.go b/providers/apis/defi/uniswapv3/helper_test.go index f00442601..96d9e6c95 100644 --- a/providers/apis/defi/uniswapv3/helper_test.go +++ b/providers/apis/defi/uniswapv3/helper_test.go @@ -4,34 +4,20 @@ import ( "testing" "github.com/ethereum/go-ethereum/rpc" - pkgtypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" - "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3/mocks" - "github.com/skip-mev/slinky/providers/base/api/metrics" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "go.uber.org/zap" -) - -const ( - // precision is the precision used for big.Float calculations. Specifically - // this is used to ensure that float values are the same within a certain - // precision. - precision = 30 - // acceptableDelta is the acceptable difference between the expected and actual price. - // In this case, we use a delta of 1e-8. This means we will accept any price that is - // within 1e-8 of the expected price. - acceptableDelta = 1e-8 + "github.com/skip-mev/slinky/oracle/types" + "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" + "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3/mocks" ) var ( logger, _ = zap.NewDevelopment() - m = metrics.NewNopAPIMetrics() // PoolConfigs used for testing. - weth_usdc_cfg = uniswapv3.PoolConfig{ //nolint + wethusdcCfg = uniswapv3.PoolConfig{ Address: "0x8ad599c3A0ff1De082011EFDDc58f1908eb6e6D8", BaseDecimals: 18, QuoteDecimals: 6, @@ -39,14 +25,7 @@ var ( } // Tickers used for testing. - weth_usdc_ticker = mmtypes.Ticker{ //nolint - CurrencyPair: pkgtypes.CurrencyPair{ - Base: "WETH", - Quote: "USDC", - }, - Decimals: 18, - Metadata_JSON: weth_usdc_cfg.MustToJSON(), - } + wethusdcTicker = types.NewProviderTicker("WETH/USDC", wethusdcCfg.MustToJSON()) ) func createPriceFetcher( @@ -57,7 +36,6 @@ func createPriceFetcher( client := mocks.NewEVMClient(t) fetcher, err := uniswapv3.NewPriceFetcher( logger, - m, uniswapv3.DefaultAPIConfig, client, ) @@ -74,7 +52,6 @@ func createPriceFetcherWithClient( fetcher, err := uniswapv3.NewPriceFetcher( logger, - m, uniswapv3.DefaultAPIConfig, client, ) diff --git a/providers/apis/defi/uniswapv3/math.go b/providers/apis/defi/uniswapv3/math.go index 1e046798c..1185e2f2f 100644 --- a/providers/apis/defi/uniswapv3/math.go +++ b/providers/apis/defi/uniswapv3/math.go @@ -4,8 +4,6 @@ import ( "math/big" "github.com/skip-mev/slinky/pkg/math" - "github.com/skip-mev/slinky/pkg/math/oracle" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) // ConvertSquareRootX96Price converts the slot 0 sqrtPriceX96 value to a price. Note that this @@ -30,47 +28,22 @@ func ConvertSquareRootX96Price( return new(big.Float).Mul(sqrtPriceFloat, sqrtPriceFloat) } -// ScalePrice scales the price to the desired ticker decimals. The price is first normalized to -// the token decimals in the erc20 token contracts. The price is then scaled to the desired -// ticker decimals. The price is inverted if the configuration specifies to do so. +// ScalePrice scales the price to the desired ticker decimals. The price is normalized to +// the token decimals in the erc20 token contracts. func ScalePrice( - ticker mmtypes.Ticker, cfg PoolConfig, price *big.Float, ) *big.Float { // Adjust the price based on the difference between the token decimals in the erc20 token contracts. - erc20ScalingFactor := GetScalingFactor( + erc20ScalingFactor := math.GetScalingFactor( cfg.BaseDecimals, cfg.QuoteDecimals, ) // Invert the price if the configuration specifies to do so. - var scaledERC20AdjustedPrice *big.Float if cfg.Invert { - scaledERC20AdjustedPrice = new(big.Float).Quo(price, erc20ScalingFactor) - scaledERC20AdjustedPrice = new(big.Float).Quo(big.NewFloat(1), scaledERC20AdjustedPrice) - } else { - scaledERC20AdjustedPrice = new(big.Float).Mul(price, erc20ScalingFactor) + scaledERC20AdjustedPrice := new(big.Float).Quo(price, erc20ScalingFactor) + return new(big.Float).Quo(big.NewFloat(1), scaledERC20AdjustedPrice) } - - one := new(big.Float).SetInt(oracle.ScaledOne(ticker.Decimals)) - return new(big.Float).Mul(scaledERC20AdjustedPrice, one) -} - -// GetScalingFactor returns the scaling factor for the price based on the difference between -// the token decimals in the erc20 token contracts. Please read over the Uniswap V3 math primer -// for more information on how this is utilized. -func GetScalingFactor( - first, second int64, -) *big.Float { - // Determine the scaling factor for the price. - decimalDiff := first - second - exp := new(big.Float).SetInt( - new(big.Int).Exp(big.NewInt(10), big.NewInt(math.Abs(decimalDiff)), nil), - ) - - if decimalDiff > 0 { - return exp - } - return new(big.Float).Quo(big.NewFloat(1), exp) + return new(big.Float).Mul(price, erc20ScalingFactor) } diff --git a/providers/apis/defi/uniswapv3/math_test.go b/providers/apis/defi/uniswapv3/math_test.go index 6ea33e24e..29fe443a8 100644 --- a/providers/apis/defi/uniswapv3/math_test.go +++ b/providers/apis/defi/uniswapv3/math_test.go @@ -4,9 +4,9 @@ import ( "math/big" "testing" - "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" "github.com/stretchr/testify/require" + + "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" ) func TestConvertSquareRootX96Price(t *testing.T) { @@ -14,22 +14,22 @@ func TestConvertSquareRootX96Price(t *testing.T) { val, converted := big.NewInt(1).SetString("2018382873588440326581633304624437", 10) require.True(t, converted) - expected := big.NewFloat(649004842.7013700766389061032587755).SetPrec(precision) - actual := uniswapv3.ConvertSquareRootX96Price(val).SetPrec(precision) + expected := big.NewFloat(649004842.7013700766389061032587755).SetPrec(40) + actual := uniswapv3.ConvertSquareRootX96Price(val).SetPrec(40) require.Equal(t, expected, actual) }) t.Run("works with a value of 0", func(t *testing.T) { val := big.NewInt(0) - expected := big.NewFloat(0).SetPrec(precision) - actual := uniswapv3.ConvertSquareRootX96Price(val).SetPrec(precision) + expected := big.NewFloat(0).SetPrec(40) + actual := uniswapv3.ConvertSquareRootX96Price(val).SetPrec(40) require.Equal(t, expected, actual) }) t.Run("should be 1 when the value is 2^96", func(t *testing.T) { val := new(big.Int).Exp(big.NewInt(2), big.NewInt(96), nil) - expected := big.NewFloat(1).SetPrec(precision) - actual := uniswapv3.ConvertSquareRootX96Price(val).SetPrec(precision) + expected := big.NewFloat(1).SetPrec(40) + actual := uniswapv3.ConvertSquareRootX96Price(val).SetPrec(40) require.Equal(t, expected, actual) }) } @@ -39,7 +39,6 @@ func TestScalePrice(t *testing.T) { name string price *big.Float cfg uniswapv3.PoolConfig - ticker mmtypes.Ticker expected *big.Float }{ { @@ -50,23 +49,7 @@ func TestScalePrice(t *testing.T) { QuoteDecimals: 6, Invert: true, }, - ticker: mmtypes.Ticker{ - Decimals: 18, - }, - expected: big.NewFloat(1540.82 * 1e18), - }, - { - name: "uniswap primer example for eth/usdc but with lower precision", - price: big.NewFloat(649004842.70137), - cfg: uniswapv3.PoolConfig{ - BaseDecimals: 18, - QuoteDecimals: 6, - Invert: true, - }, - ticker: mmtypes.Ticker{ - Decimals: 6, - }, - expected: big.NewFloat(1540.82 * 1e6), + expected: big.NewFloat(1540.820552028), }, { name: "mainnet example for weth/usdc", @@ -76,23 +59,7 @@ func TestScalePrice(t *testing.T) { QuoteDecimals: 6, Invert: true, }, - ticker: mmtypes.Ticker{ - Decimals: 18, - }, - expected: big.NewFloat(3431.960802205393266704 * 1e18), - }, - { - name: "mainnet example for weth/usdc but with lower precision", - price: big.NewFloat(2.913786192888320737692333570997812e+08), - cfg: uniswapv3.PoolConfig{ - BaseDecimals: 18, - QuoteDecimals: 6, - Invert: true, - }, - ticker: mmtypes.Ticker{ - Decimals: 6, - }, - expected: big.NewFloat(3431.96 * 1e6), + expected: big.NewFloat(3431.960802205393266704), }, { name: "mainnet example for eth/usdc", @@ -102,10 +69,7 @@ func TestScalePrice(t *testing.T) { QuoteDecimals: 6, Invert: true, }, - ticker: mmtypes.Ticker{ - Decimals: 18, - }, - expected: big.NewFloat(3416.880715658719806983 * 1e18), + expected: big.NewFloat(3416.880715658719806983), }, { name: "mainnet example for mog/eth", @@ -115,23 +79,7 @@ func TestScalePrice(t *testing.T) { QuoteDecimals: 18, Invert: false, }, - ticker: mmtypes.Ticker{ - Decimals: 18, - }, - expected: big.NewFloat(163833946), - }, - { - name: "mainnet example for mog/eth but with lower precision", - price: big.NewFloat(1.63833946559934409985296037965e-10), - cfg: uniswapv3.PoolConfig{ - BaseDecimals: 18, - QuoteDecimals: 18, - Invert: false, - }, - ticker: mmtypes.Ticker{ - Decimals: 12, - }, - expected: big.NewFloat(163.833946), + expected: big.NewFloat(1.63833946559934409985296037965e-10), }, { name: "mainnet example for btc/usdt", @@ -141,10 +89,7 @@ func TestScalePrice(t *testing.T) { QuoteDecimals: 6, Invert: false, }, - ticker: mmtypes.Ticker{ - Decimals: 5, - }, - expected: big.NewFloat(68889.36521667327881055693350566 * 1e5), + expected: big.NewFloat(68889.36521667327881055693350566), }, { name: "mainnet example for btc/usdt where usdt now assumes 10", @@ -154,64 +99,14 @@ func TestScalePrice(t *testing.T) { QuoteDecimals: 10, Invert: false, }, - ticker: mmtypes.Ticker{ - Decimals: 5, - }, - expected: big.NewFloat(68889.36521667327881055693350566 * 1e5), + expected: big.NewFloat(68889.36521667327881055693350566), }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - actual := uniswapv3.ScalePrice(tc.ticker, tc.cfg, tc.price).SetPrec(5) - require.Equal(t, tc.expected.SetPrec(5), actual) + actual := uniswapv3.ScalePrice(tc.cfg, tc.price).SetPrec(40) + require.Equal(t, tc.expected.SetPrec(40), actual) }) } } - -func TestGetScalingFactor(t *testing.T) { - t.Run("base and quote decimals for erc20 tokens are the same", func(t *testing.T) { - cfg := uniswapv3.PoolConfig{ - BaseDecimals: 18, - QuoteDecimals: 18, - } - - actual := uniswapv3.GetScalingFactor( - cfg.BaseDecimals, - cfg.QuoteDecimals, - ).SetPrec(precision) - - expected := big.NewFloat(1).SetPrec(precision) - require.Equal(t, expected, actual) - }) - - t.Run("base decimals are greater than quote decimals for erc20 tokens", func(t *testing.T) { - cfg := uniswapv3.PoolConfig{ - BaseDecimals: 18, - QuoteDecimals: 6, - } - - actual := uniswapv3.GetScalingFactor( - cfg.BaseDecimals, - cfg.QuoteDecimals, - ).SetPrec(precision) - - expected := big.NewFloat(1e12).SetPrec(precision) - require.Equal(t, expected, actual) - }) - - t.Run("quote decimals are greater than base decimals for erc20 tokens", func(t *testing.T) { - cfg := uniswapv3.PoolConfig{ - BaseDecimals: 6, - QuoteDecimals: 18, - } - - actual := uniswapv3.GetScalingFactor( - cfg.BaseDecimals, - cfg.QuoteDecimals, - ).SetPrec(precision) - - expected := big.NewFloat(1e-12).SetPrec(precision) - require.Equal(t, expected, actual) - }) -} diff --git a/providers/apis/defi/uniswapv3/mocks/EVMClient.go b/providers/apis/defi/uniswapv3/mocks/EVMClient.go index b91db5fe9..b3cbaf910 100644 --- a/providers/apis/defi/uniswapv3/mocks/EVMClient.go +++ b/providers/apis/defi/uniswapv3/mocks/EVMClient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.30.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package mocks @@ -18,6 +18,10 @@ type EVMClient struct { func (_m *EVMClient) BatchCallContext(ctx context.Context, calls []rpc.BatchElem) error { ret := _m.Called(ctx, calls) + if len(ret) == 0 { + panic("no return value specified for BatchCallContext") + } + var r0 error if rf, ok := ret.Get(0).(func(context.Context, []rpc.BatchElem) error); ok { r0 = rf(ctx, calls) diff --git a/providers/apis/defi/uniswapv3/pool/uniswap_v3_pool.go b/providers/apis/defi/uniswapv3/pool/uniswap_v3_pool.go index 7ff5814a5..7f0487bd0 100644 --- a/providers/apis/defi/uniswapv3/pool/uniswap_v3_pool.go +++ b/providers/apis/defi/uniswapv3/pool/uniswap_v3_pool.go @@ -186,7 +186,6 @@ func (_Uniswap *UniswapTransactorRaw) Transact(opts *bind.TransactOpts, method s func (_Uniswap *UniswapCaller) Factory(opts *bind.CallOpts) (common.Address, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "factory") - if err != nil { return *new(common.Address), err } @@ -194,7 +193,6 @@ func (_Uniswap *UniswapCaller) Factory(opts *bind.CallOpts) (common.Address, err out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) return out0, err - } // Factory is a free data retrieval call binding the contract method 0xc45a0155. @@ -217,7 +215,6 @@ func (_Uniswap *UniswapCallerSession) Factory() (common.Address, error) { func (_Uniswap *UniswapCaller) Fee(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "fee") - if err != nil { return *new(*big.Int), err } @@ -225,7 +222,6 @@ func (_Uniswap *UniswapCaller) Fee(opts *bind.CallOpts) (*big.Int, error) { out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // Fee is a free data retrieval call binding the contract method 0xddca3f43. @@ -248,7 +244,6 @@ func (_Uniswap *UniswapCallerSession) Fee() (*big.Int, error) { func (_Uniswap *UniswapCaller) FeeGrowthGlobal0X128(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "feeGrowthGlobal0X128") - if err != nil { return *new(*big.Int), err } @@ -256,7 +251,6 @@ func (_Uniswap *UniswapCaller) FeeGrowthGlobal0X128(opts *bind.CallOpts) (*big.I out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // FeeGrowthGlobal0X128 is a free data retrieval call binding the contract method 0xf3058399. @@ -279,7 +273,6 @@ func (_Uniswap *UniswapCallerSession) FeeGrowthGlobal0X128() (*big.Int, error) { func (_Uniswap *UniswapCaller) FeeGrowthGlobal1X128(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "feeGrowthGlobal1X128") - if err != nil { return *new(*big.Int), err } @@ -287,7 +280,6 @@ func (_Uniswap *UniswapCaller) FeeGrowthGlobal1X128(opts *bind.CallOpts) (*big.I out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // FeeGrowthGlobal1X128 is a free data retrieval call binding the contract method 0x46141319. @@ -310,7 +302,6 @@ func (_Uniswap *UniswapCallerSession) FeeGrowthGlobal1X128() (*big.Int, error) { func (_Uniswap *UniswapCaller) Liquidity(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "liquidity") - if err != nil { return *new(*big.Int), err } @@ -318,7 +309,6 @@ func (_Uniswap *UniswapCaller) Liquidity(opts *bind.CallOpts) (*big.Int, error) out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // Liquidity is a free data retrieval call binding the contract method 0x1a686502. @@ -341,7 +331,6 @@ func (_Uniswap *UniswapCallerSession) Liquidity() (*big.Int, error) { func (_Uniswap *UniswapCaller) MaxLiquidityPerTick(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "maxLiquidityPerTick") - if err != nil { return *new(*big.Int), err } @@ -349,7 +338,6 @@ func (_Uniswap *UniswapCaller) MaxLiquidityPerTick(opts *bind.CallOpts) (*big.In out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // MaxLiquidityPerTick is a free data retrieval call binding the contract method 0x70cf754a. @@ -374,7 +362,8 @@ func (_Uniswap *UniswapCaller) Observations(opts *bind.CallOpts, arg0 *big.Int) TickCumulative *big.Int SecondsPerLiquidityCumulativeX128 *big.Int Initialized bool -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "observations", arg0) @@ -394,7 +383,6 @@ func (_Uniswap *UniswapCaller) Observations(opts *bind.CallOpts, arg0 *big.Int) outstruct.Initialized = *abi.ConvertType(out[3], new(bool)).(*bool) return *outstruct, err - } // Observations is a free data retrieval call binding the contract method 0x252c09d7. @@ -405,7 +393,8 @@ func (_Uniswap *UniswapSession) Observations(arg0 *big.Int) (struct { TickCumulative *big.Int SecondsPerLiquidityCumulativeX128 *big.Int Initialized bool -}, error) { +}, error, +) { return _Uniswap.Contract.Observations(&_Uniswap.CallOpts, arg0) } @@ -417,7 +406,8 @@ func (_Uniswap *UniswapCallerSession) Observations(arg0 *big.Int) (struct { TickCumulative *big.Int SecondsPerLiquidityCumulativeX128 *big.Int Initialized bool -}, error) { +}, error, +) { return _Uniswap.Contract.Observations(&_Uniswap.CallOpts, arg0) } @@ -427,7 +417,8 @@ func (_Uniswap *UniswapCallerSession) Observations(arg0 *big.Int) (struct { func (_Uniswap *UniswapCaller) Observe(opts *bind.CallOpts, secondsAgos []uint32) (struct { TickCumulatives []*big.Int SecondsPerLiquidityCumulativeX128s []*big.Int -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "observe", secondsAgos) @@ -443,7 +434,6 @@ func (_Uniswap *UniswapCaller) Observe(opts *bind.CallOpts, secondsAgos []uint32 outstruct.SecondsPerLiquidityCumulativeX128s = *abi.ConvertType(out[1], new([]*big.Int)).(*[]*big.Int) return *outstruct, err - } // Observe is a free data retrieval call binding the contract method 0x883bdbfd. @@ -452,7 +442,8 @@ func (_Uniswap *UniswapCaller) Observe(opts *bind.CallOpts, secondsAgos []uint32 func (_Uniswap *UniswapSession) Observe(secondsAgos []uint32) (struct { TickCumulatives []*big.Int SecondsPerLiquidityCumulativeX128s []*big.Int -}, error) { +}, error, +) { return _Uniswap.Contract.Observe(&_Uniswap.CallOpts, secondsAgos) } @@ -462,7 +453,8 @@ func (_Uniswap *UniswapSession) Observe(secondsAgos []uint32) (struct { func (_Uniswap *UniswapCallerSession) Observe(secondsAgos []uint32) (struct { TickCumulatives []*big.Int SecondsPerLiquidityCumulativeX128s []*big.Int -}, error) { +}, error, +) { return _Uniswap.Contract.Observe(&_Uniswap.CallOpts, secondsAgos) } @@ -475,7 +467,8 @@ func (_Uniswap *UniswapCaller) Positions(opts *bind.CallOpts, arg0 [32]byte) (st FeeGrowthInside1LastX128 *big.Int TokensOwed0 *big.Int TokensOwed1 *big.Int -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "positions", arg0) @@ -497,7 +490,6 @@ func (_Uniswap *UniswapCaller) Positions(opts *bind.CallOpts, arg0 [32]byte) (st outstruct.TokensOwed1 = *abi.ConvertType(out[4], new(*big.Int)).(**big.Int) return *outstruct, err - } // Positions is a free data retrieval call binding the contract method 0x514ea4bf. @@ -509,7 +501,8 @@ func (_Uniswap *UniswapSession) Positions(arg0 [32]byte) (struct { FeeGrowthInside1LastX128 *big.Int TokensOwed0 *big.Int TokensOwed1 *big.Int -}, error) { +}, error, +) { return _Uniswap.Contract.Positions(&_Uniswap.CallOpts, arg0) } @@ -522,7 +515,8 @@ func (_Uniswap *UniswapCallerSession) Positions(arg0 [32]byte) (struct { FeeGrowthInside1LastX128 *big.Int TokensOwed0 *big.Int TokensOwed1 *big.Int -}, error) { +}, error, +) { return _Uniswap.Contract.Positions(&_Uniswap.CallOpts, arg0) } @@ -532,7 +526,8 @@ func (_Uniswap *UniswapCallerSession) Positions(arg0 [32]byte) (struct { func (_Uniswap *UniswapCaller) ProtocolFees(opts *bind.CallOpts) (struct { Token0 *big.Int Token1 *big.Int -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "protocolFees") @@ -548,7 +543,6 @@ func (_Uniswap *UniswapCaller) ProtocolFees(opts *bind.CallOpts) (struct { outstruct.Token1 = *abi.ConvertType(out[1], new(*big.Int)).(**big.Int) return *outstruct, err - } // ProtocolFees is a free data retrieval call binding the contract method 0x1ad8b03b. @@ -557,7 +551,8 @@ func (_Uniswap *UniswapCaller) ProtocolFees(opts *bind.CallOpts) (struct { func (_Uniswap *UniswapSession) ProtocolFees() (struct { Token0 *big.Int Token1 *big.Int -}, error) { +}, error, +) { return _Uniswap.Contract.ProtocolFees(&_Uniswap.CallOpts) } @@ -567,7 +562,8 @@ func (_Uniswap *UniswapSession) ProtocolFees() (struct { func (_Uniswap *UniswapCallerSession) ProtocolFees() (struct { Token0 *big.Int Token1 *big.Int -}, error) { +}, error, +) { return _Uniswap.Contract.ProtocolFees(&_Uniswap.CallOpts) } @@ -582,7 +578,8 @@ func (_Uniswap *UniswapCaller) Slot0(opts *bind.CallOpts) (struct { ObservationCardinalityNext uint16 FeeProtocol uint8 Unlocked bool -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "slot0") @@ -608,7 +605,6 @@ func (_Uniswap *UniswapCaller) Slot0(opts *bind.CallOpts) (struct { outstruct.Unlocked = *abi.ConvertType(out[6], new(bool)).(*bool) return *outstruct, err - } // Slot0 is a free data retrieval call binding the contract method 0x3850c7bd. @@ -622,7 +618,8 @@ func (_Uniswap *UniswapSession) Slot0() (struct { ObservationCardinalityNext uint16 FeeProtocol uint8 Unlocked bool -}, error) { +}, error, +) { return _Uniswap.Contract.Slot0(&_Uniswap.CallOpts) } @@ -637,7 +634,8 @@ func (_Uniswap *UniswapCallerSession) Slot0() (struct { ObservationCardinalityNext uint16 FeeProtocol uint8 Unlocked bool -}, error) { +}, error, +) { return _Uniswap.Contract.Slot0(&_Uniswap.CallOpts) } @@ -648,7 +646,8 @@ func (_Uniswap *UniswapCaller) SnapshotCumulativesInside(opts *bind.CallOpts, ti TickCumulativeInside *big.Int SecondsPerLiquidityInsideX128 *big.Int SecondsInside uint32 -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "snapshotCumulativesInside", tickLower, tickUpper) @@ -666,7 +665,6 @@ func (_Uniswap *UniswapCaller) SnapshotCumulativesInside(opts *bind.CallOpts, ti outstruct.SecondsInside = *abi.ConvertType(out[2], new(uint32)).(*uint32) return *outstruct, err - } // SnapshotCumulativesInside is a free data retrieval call binding the contract method 0xa38807f2. @@ -676,7 +674,8 @@ func (_Uniswap *UniswapSession) SnapshotCumulativesInside(tickLower *big.Int, ti TickCumulativeInside *big.Int SecondsPerLiquidityInsideX128 *big.Int SecondsInside uint32 -}, error) { +}, error, +) { return _Uniswap.Contract.SnapshotCumulativesInside(&_Uniswap.CallOpts, tickLower, tickUpper) } @@ -687,7 +686,8 @@ func (_Uniswap *UniswapCallerSession) SnapshotCumulativesInside(tickLower *big.I TickCumulativeInside *big.Int SecondsPerLiquidityInsideX128 *big.Int SecondsInside uint32 -}, error) { +}, error, +) { return _Uniswap.Contract.SnapshotCumulativesInside(&_Uniswap.CallOpts, tickLower, tickUpper) } @@ -697,7 +697,6 @@ func (_Uniswap *UniswapCallerSession) SnapshotCumulativesInside(tickLower *big.I func (_Uniswap *UniswapCaller) TickBitmap(opts *bind.CallOpts, arg0 int16) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "tickBitmap", arg0) - if err != nil { return *new(*big.Int), err } @@ -705,7 +704,6 @@ func (_Uniswap *UniswapCaller) TickBitmap(opts *bind.CallOpts, arg0 int16) (*big out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // TickBitmap is a free data retrieval call binding the contract method 0x5339c296. @@ -728,7 +726,6 @@ func (_Uniswap *UniswapCallerSession) TickBitmap(arg0 int16) (*big.Int, error) { func (_Uniswap *UniswapCaller) TickSpacing(opts *bind.CallOpts) (*big.Int, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "tickSpacing") - if err != nil { return *new(*big.Int), err } @@ -736,7 +733,6 @@ func (_Uniswap *UniswapCaller) TickSpacing(opts *bind.CallOpts) (*big.Int, error out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int) return out0, err - } // TickSpacing is a free data retrieval call binding the contract method 0xd0c93a7c. @@ -765,7 +761,8 @@ func (_Uniswap *UniswapCaller) Ticks(opts *bind.CallOpts, arg0 *big.Int) (struct SecondsPerLiquidityOutsideX128 *big.Int SecondsOutside uint32 Initialized bool -}, error) { +}, error, +) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "ticks", arg0) @@ -793,7 +790,6 @@ func (_Uniswap *UniswapCaller) Ticks(opts *bind.CallOpts, arg0 *big.Int) (struct outstruct.Initialized = *abi.ConvertType(out[7], new(bool)).(*bool) return *outstruct, err - } // Ticks is a free data retrieval call binding the contract method 0xf30dba93. @@ -808,7 +804,8 @@ func (_Uniswap *UniswapSession) Ticks(arg0 *big.Int) (struct { SecondsPerLiquidityOutsideX128 *big.Int SecondsOutside uint32 Initialized bool -}, error) { +}, error, +) { return _Uniswap.Contract.Ticks(&_Uniswap.CallOpts, arg0) } @@ -824,7 +821,8 @@ func (_Uniswap *UniswapCallerSession) Ticks(arg0 *big.Int) (struct { SecondsPerLiquidityOutsideX128 *big.Int SecondsOutside uint32 Initialized bool -}, error) { +}, error, +) { return _Uniswap.Contract.Ticks(&_Uniswap.CallOpts, arg0) } @@ -834,7 +832,6 @@ func (_Uniswap *UniswapCallerSession) Ticks(arg0 *big.Int) (struct { func (_Uniswap *UniswapCaller) Token0(opts *bind.CallOpts) (common.Address, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "token0") - if err != nil { return *new(common.Address), err } @@ -842,7 +839,6 @@ func (_Uniswap *UniswapCaller) Token0(opts *bind.CallOpts) (common.Address, erro out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) return out0, err - } // Token0 is a free data retrieval call binding the contract method 0x0dfe1681. @@ -865,7 +861,6 @@ func (_Uniswap *UniswapCallerSession) Token0() (common.Address, error) { func (_Uniswap *UniswapCaller) Token1(opts *bind.CallOpts) (common.Address, error) { var out []interface{} err := _Uniswap.contract.Call(opts, &out, "token1") - if err != nil { return *new(common.Address), err } @@ -873,7 +868,6 @@ func (_Uniswap *UniswapCaller) Token1(opts *bind.CallOpts) (common.Address, erro out0 := *abi.ConvertType(out[0], new(common.Address)).(*common.Address) return out0, err - } // Token1 is a free data retrieval call binding the contract method 0xd21220a7. @@ -1161,7 +1155,6 @@ type UniswapBurn struct { // // Solidity: event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) func (_Uniswap *UniswapFilterer) FilterBurn(opts *bind.FilterOpts, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (*UniswapBurnIterator, error) { - var ownerRule []interface{} for _, ownerItem := range owner { ownerRule = append(ownerRule, ownerItem) @@ -1186,7 +1179,6 @@ func (_Uniswap *UniswapFilterer) FilterBurn(opts *bind.FilterOpts, owner []commo // // Solidity: event Burn(address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) func (_Uniswap *UniswapFilterer) WatchBurn(opts *bind.WatchOpts, sink chan<- *UniswapBurn, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (event.Subscription, error) { - var ownerRule []interface{} for _, ownerItem := range owner { ownerRule = append(ownerRule, ownerItem) @@ -1326,7 +1318,6 @@ type UniswapCollect struct { // // Solidity: event Collect(address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1) func (_Uniswap *UniswapFilterer) FilterCollect(opts *bind.FilterOpts, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (*UniswapCollectIterator, error) { - var ownerRule []interface{} for _, ownerItem := range owner { ownerRule = append(ownerRule, ownerItem) @@ -1352,7 +1343,6 @@ func (_Uniswap *UniswapFilterer) FilterCollect(opts *bind.FilterOpts, owner []co // // Solidity: event Collect(address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1) func (_Uniswap *UniswapFilterer) WatchCollect(opts *bind.WatchOpts, sink chan<- *UniswapCollect, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (event.Subscription, error) { - var ownerRule []interface{} for _, ownerItem := range owner { ownerRule = append(ownerRule, ownerItem) @@ -1491,7 +1481,6 @@ type UniswapCollectProtocol struct { // // Solidity: event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1) func (_Uniswap *UniswapFilterer) FilterCollectProtocol(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*UniswapCollectProtocolIterator, error) { - var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) @@ -1512,7 +1501,6 @@ func (_Uniswap *UniswapFilterer) FilterCollectProtocol(opts *bind.FilterOpts, se // // Solidity: event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1) func (_Uniswap *UniswapFilterer) WatchCollectProtocol(opts *bind.WatchOpts, sink chan<- *UniswapCollectProtocol, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) @@ -1648,7 +1636,6 @@ type UniswapFlash struct { // // Solidity: event Flash(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1) func (_Uniswap *UniswapFilterer) FilterFlash(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*UniswapFlashIterator, error) { - var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) @@ -1669,7 +1656,6 @@ func (_Uniswap *UniswapFilterer) FilterFlash(opts *bind.FilterOpts, sender []com // // Solidity: event Flash(address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1) func (_Uniswap *UniswapFilterer) WatchFlash(opts *bind.WatchOpts, sink chan<- *UniswapFlash, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) @@ -1801,7 +1787,6 @@ type UniswapIncreaseObservationCardinalityNext struct { // // Solidity: event IncreaseObservationCardinalityNext(uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew) func (_Uniswap *UniswapFilterer) FilterIncreaseObservationCardinalityNext(opts *bind.FilterOpts) (*UniswapIncreaseObservationCardinalityNextIterator, error) { - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "IncreaseObservationCardinalityNext") if err != nil { return nil, err @@ -1813,7 +1798,6 @@ func (_Uniswap *UniswapFilterer) FilterIncreaseObservationCardinalityNext(opts * // // Solidity: event IncreaseObservationCardinalityNext(uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew) func (_Uniswap *UniswapFilterer) WatchIncreaseObservationCardinalityNext(opts *bind.WatchOpts, sink chan<- *UniswapIncreaseObservationCardinalityNext) (event.Subscription, error) { - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "IncreaseObservationCardinalityNext") if err != nil { return nil, err @@ -1936,7 +1920,6 @@ type UniswapInitialize struct { // // Solidity: event Initialize(uint160 sqrtPriceX96, int24 tick) func (_Uniswap *UniswapFilterer) FilterInitialize(opts *bind.FilterOpts) (*UniswapInitializeIterator, error) { - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "Initialize") if err != nil { return nil, err @@ -1948,7 +1931,6 @@ func (_Uniswap *UniswapFilterer) FilterInitialize(opts *bind.FilterOpts) (*Unisw // // Solidity: event Initialize(uint160 sqrtPriceX96, int24 tick) func (_Uniswap *UniswapFilterer) WatchInitialize(opts *bind.WatchOpts, sink chan<- *UniswapInitialize) (event.Subscription, error) { - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "Initialize") if err != nil { return nil, err @@ -2076,7 +2058,6 @@ type UniswapMint struct { // // Solidity: event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) func (_Uniswap *UniswapFilterer) FilterMint(opts *bind.FilterOpts, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (*UniswapMintIterator, error) { - var ownerRule []interface{} for _, ownerItem := range owner { ownerRule = append(ownerRule, ownerItem) @@ -2101,7 +2082,6 @@ func (_Uniswap *UniswapFilterer) FilterMint(opts *bind.FilterOpts, owner []commo // // Solidity: event Mint(address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1) func (_Uniswap *UniswapFilterer) WatchMint(opts *bind.WatchOpts, sink chan<- *UniswapMint, owner []common.Address, tickLower []*big.Int, tickUpper []*big.Int) (event.Subscription, error) { - var ownerRule []interface{} for _, ownerItem := range owner { ownerRule = append(ownerRule, ownerItem) @@ -2239,7 +2219,6 @@ type UniswapSetFeeProtocol struct { // // Solidity: event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New) func (_Uniswap *UniswapFilterer) FilterSetFeeProtocol(opts *bind.FilterOpts) (*UniswapSetFeeProtocolIterator, error) { - logs, sub, err := _Uniswap.contract.FilterLogs(opts, "SetFeeProtocol") if err != nil { return nil, err @@ -2251,7 +2230,6 @@ func (_Uniswap *UniswapFilterer) FilterSetFeeProtocol(opts *bind.FilterOpts) (*U // // Solidity: event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New) func (_Uniswap *UniswapFilterer) WatchSetFeeProtocol(opts *bind.WatchOpts, sink chan<- *UniswapSetFeeProtocol) (event.Subscription, error) { - logs, sub, err := _Uniswap.contract.WatchLogs(opts, "SetFeeProtocol") if err != nil { return nil, err @@ -2379,7 +2357,6 @@ type UniswapSwap struct { // // Solidity: event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick) func (_Uniswap *UniswapFilterer) FilterSwap(opts *bind.FilterOpts, sender []common.Address, recipient []common.Address) (*UniswapSwapIterator, error) { - var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) @@ -2400,7 +2377,6 @@ func (_Uniswap *UniswapFilterer) FilterSwap(opts *bind.FilterOpts, sender []comm // // Solidity: event Swap(address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick) func (_Uniswap *UniswapFilterer) WatchSwap(opts *bind.WatchOpts, sink chan<- *UniswapSwap, sender []common.Address, recipient []common.Address) (event.Subscription, error) { - var senderRule []interface{} for _, senderItem := range sender { senderRule = append(senderRule, senderItem) diff --git a/providers/apis/defi/uniswapv3/utils.go b/providers/apis/defi/uniswapv3/utils.go index f150698bc..23feae77a 100644 --- a/providers/apis/defi/uniswapv3/utils.go +++ b/providers/apis/defi/uniswapv3/utils.go @@ -6,6 +6,7 @@ import ( "time" "github.com/ethereum/go-ethereum/common" + "github.com/skip-mev/slinky/oracle/config" ) diff --git a/providers/apis/defi/uniswapv3/utils_test.go b/providers/apis/defi/uniswapv3/utils_test.go index 677507f73..33da15f5e 100644 --- a/providers/apis/defi/uniswapv3/utils_test.go +++ b/providers/apis/defi/uniswapv3/utils_test.go @@ -3,8 +3,9 @@ package uniswapv3_test import ( "testing" - "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" "github.com/stretchr/testify/require" + + "github.com/skip-mev/slinky/providers/apis/defi/uniswapv3" ) func TestPoolConfig(t *testing.T) { diff --git a/providers/apis/dydx/README.md b/providers/apis/dydx/README.md index 231c14178..1f505aee2 100644 --- a/providers/apis/dydx/README.md +++ b/providers/apis/dydx/README.md @@ -28,325 +28,8 @@ The ticker conversions are used to convert the specific parameters associated wi * `exponent` - In the side-car we represent all prices in `Decimals`, which is the absolute value of the `exponent`. * `min_exchanges` - This is the minimum number of exchanges that need to provide prices for the market to be considered valid. This is a direct mapping to `MinProviderCount` in the side-car. * `min_price_change_ppm` - This is currently not applicable to the side car and is not utilized. -* `exchange_config_json` - This is a list of exchanges that need to provide prices. Read more about the exchange conversions below. -## Exchange Conversions - -There are four cases we consider when converting the exchange configurations: - -### 1. Direct Conversion - -This is the simplest case where the exchange ticker is the same as the market ticker. Example: - -```json -{ - "id": 0, - "pair": "BTC-USD", - "exponent": -5, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"CoinbasePro\",\"ticker\":\"BTC-USD\"}]}" -} -``` - -```json -{ - "exchanges": [ - { - "exchangeName": "CoinbasePro", - "ticker": "BTC-USD" - } - ] -} -``` - -In this case, we update the `BTC-USD`'s set of paths to include a single path with a single operation of CoinbasePro `BTC-USD` -> `BTC-USD`. Additionally we update the `BTC-USD`'s providers to include (CoinBasePro, BTC-USD). - -Translated to the side-car, this would look like: - -```json -{ - "tickers": { - "BTC/USD": { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "decimals": 5, - "min_provider_count": 3 - } - }, - "paths": { - "BTC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "CoinbasePro" - } - ] - } - ] - } - }, - "providers": { - "BTC/USD": { - "providers": [ - { - "name": "CoinbasePro", - "off_chain_ticker": "BTC-USD" - } - ] - } - }, -} - -``` - -#### 2. Inverted Conversion - -This is the case where the exchange ticker is inverted from the market ticker. Example: - -```json -{ - "id": 1000000, - "pair": "USDT-USD", - "exponent": -9, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Binance\",\"ticker\":\"USDCUSDT\",\"invert\":true}]}" -} -``` - -```json -{ - "exchanges": [ - { - "exchangeName": "Binance", - "ticker": "USDCUSDT", - "invert": true - } - ] -} -``` - -In this case, we update the `USDT-USD`'s set of paths to include a single path with a single operation of Binance `USDCUSDT` ^-1 -> `USDT-USD`. Additionally we update the `USDT-USD`'s providers to include (Binance, USDCUSDT). - -Translated to the side-car, this would look like: - -```json -{ - "tickers": { - "USDT/USD": { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - } - }, - "paths": { - "USDT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "Binance", - "invert": true - } - ] - } - ] - } - }, - "providers": { - "USDT/USD": { - "providers": [ - { - "name": "Binance", - "off_chain_ticker": "USDCUSDT" - } - ] - } - }, -} -``` - -#### 3. Indirect Conversion - -This is the case where the ticker is not directly associated with the market ticker, but can be converted to the market ticker using another market (the index price). Example: - -```json -{ - "id": 0, - "pair": "BTC-USD", - "exponent": -5, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Okx\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"USDT-USD\"}]}" -} -``` - -```json -{ - "exchanges": [ - { - "exchangeName": "Okx", - "ticker": "BTC-USDT", - "adjustByMarket": "USDT-USD" - } - ] -} -``` - -In this case, we update the `BTC-USD`'s set of paths to include a single path with two operations of Okx `BTC-USDT` * Index `USDT-USD` -> `BTC-USD`. Additionally we update the `BTC-USD`'s providers to include (Okx, BTC-USDT). - -Translated to the side-car, this would look like: - -```json -{ - "tickers": { - "BTC/USD": { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "decimals": 5, - "min_provider_count": 3 - } - }, - "paths": { - "BTC/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "Okx" - }, - { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "provider": "Index" // This is the index price (previously computed median price) - } - ] - } - ] - } - }, - "providers": { - "BTC/USD": { - "providers": [ - { - "name": "Okx", - "off_chain_ticker": "BTC-USDT" - } - ] - } - } -} -``` - -### 4. Indirect Inverted Conversion - -This is the case where the ticker is not directly associated with the market ticker, but can be converted to the market ticker using another market, and the ticker is inverted. Example: - -```json -{ - "id": 1000000, - "pair": "USDT-USD", - "exponent": -9, - "min_exchanges": 3, - "min_price_change_ppm": 1000, - "exchange_config_json": "{\"exchanges\":[{\"exchangeName\":\"Kucoin\",\"ticker\":\"BTC-USDT\",\"adjustByMarket\":\"BTC-USD\",\"invert\":true}]}" -} -``` - -```json -{ - "exchanges": [ - { - "exchangeName": "Kucoin", - "ticker": "BTC-USDT", - "adjustByMarket": "BTC-USD", - "invert": true - } - ] -} -``` - -In this case, we update the `USDT-USD`'s set of paths to include a single path with two operations of Kucoin (`BTC-USDT` * ^-1) * Index `BTC-USD` -> `USDT-USD`. In this case, we DO NOT update the `USDT-USD`'s providers to include (Kucoin, BTC-USDT) as we assume the index price is provided by the side-car in combination with other providers. - -We assume that the BTC/USD market will define the relevant providers including Kucoin separately. - -Translated to the side-car, this would look like: - -```json -{ - "tickers": { - "USDT/USD": { - "currency_pair": { - "Base": "USDT", - "Quote": "USD" - }, - "decimals": 9, - "min_provider_count": 3 - } - }, - "paths": { - "USDT/USD": { - "paths": [ - { - "operations": [ - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "Kucoin", - "invert": true - }, - { - "currency_pair": { - "Base": "BTC", - "Quote": "USD" - }, - "provider": "Index" // This is the index price (previously computed median price) - } - ] - } - ] - } - }, - "providers": { - "BTC/USD": { // Populated by the BTC/USD market - "providers": [ - { - "name": "Kucoin", - "off_chain_ticker": "BTC-USDT" - }, - ] - }, - "USDT/USD": { - "providers": [] - } - } -} -``` +* `exchange_config_json` - This is a list of exchanges that need to provide prices. We have a very similar structure in the side-car, but we use a different format. The side-car uses a `MarketMap` to store the exchange and ticker pairs. ### Additional Considerations diff --git a/providers/apis/dydx/api_handler.go b/providers/apis/dydx/api_handler.go index 0e6dfaac3..4a6369719 100644 --- a/providers/apis/dydx/api_handler.go +++ b/providers/apis/dydx/api_handler.go @@ -20,18 +20,17 @@ var _ types.MarketMapAPIDataHandler = (*APIHandler)(nil) // by a base provider. This is specifically for fetching market data from the dYdX prices module, which is // then translated to a market map. type APIHandler struct { + logger *zap.Logger + // api is the api config for the dYdX market params API. api config.APIConfig - - // logger is the logger for the API handler. - logger *zap.Logger } // NewAPIHandler returns a new MarketMap MarketMapAPIDataHandler. func NewAPIHandler( - api config.APIConfig, logger *zap.Logger, -) (types.MarketMapAPIDataHandler, error) { + api config.APIConfig, +) (*APIHandler, error) { if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -68,6 +67,7 @@ func (h *APIHandler) ParseResponse( resp *http.Response, ) types.MarketMapResponse { if len(chains) != 1 { + h.logger.Error("expected one chain", zap.Any("chains", chains)) return types.NewMarketMapResponseWithErr( chains, providertypes.NewErrorWithCode( @@ -78,6 +78,7 @@ func (h *APIHandler) ParseResponse( } if resp == nil { + h.logger.Error("got nil response from dydx market params API") return types.NewMarketMapResponseWithErr( chains, providertypes.NewErrorWithCode( @@ -90,6 +91,7 @@ func (h *APIHandler) ParseResponse( // Parse the response body into a dydx market params response object. var params dydxtypes.QueryAllMarketParamsResponse if err := json.NewDecoder(resp.Body).Decode(¶ms); err != nil { + h.logger.Error("failed to parse dydx market params response", zap.Error(err)) return types.NewMarketMapResponseWithErr( chains, providertypes.NewErrorWithCode( @@ -100,8 +102,14 @@ func (h *APIHandler) ParseResponse( } // Convert the dydx market params to a market map. - marketResp, err := ConvertMarketParamsToMarketMap(params, h.logger) + marketResp, err := h.ConvertMarketParamsToMarketMap(params) if err != nil { + h.logger.Error( + "failed to convert dydx market params to market map", + zap.Any("params", params), + zap.Error(err), + ) + return types.NewMarketMapResponseWithErr( chains, providertypes.NewErrorWithCode( @@ -113,5 +121,7 @@ func (h *APIHandler) ParseResponse( resolved := make(types.ResolvedMarketMap) resolved[chains[0]] = types.NewMarketMapResult(&marketResp, time.Now()) + + h.logger.Info("successfully resolved market map", zap.Int("markets", len(marketResp.MarketMap.Markets))) return types.NewMarketMapResponse(resolved, nil) } diff --git a/providers/apis/dydx/api_handler_test.go b/providers/apis/dydx/api_handler_test.go index 5feea9807..95e924fdf 100644 --- a/providers/apis/dydx/api_handler_test.go +++ b/providers/apis/dydx/api_handler_test.go @@ -24,7 +24,7 @@ var chains = []types.Chain{ } func TestCreateURL(t *testing.T) { - handler, err := dydx.NewAPIHandler(dydx.DefaultAPIConfig, zap.NewNop()) + handler, err := dydx.NewAPIHandler(zap.NewNop(), dydx.DefaultAPIConfig) require.NoError(t, err) t.Run("multiple chains", func(t *testing.T) { @@ -119,7 +119,7 @@ func TestParseResponse(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - handler, err := dydx.NewAPIHandler(dydx.DefaultAPIConfig, zap.NewNop()) + handler, err := dydx.NewAPIHandler(zap.NewNop(), dydx.DefaultAPIConfig) require.NoError(t, err) resp := handler.ParseResponse(tc.chains, tc.resp()) diff --git a/providers/apis/dydx/helper_test.go b/providers/apis/dydx/helper_test.go index 37f003d99..ba325fadf 100644 --- a/providers/apis/dydx/helper_test.go +++ b/providers/apis/dydx/helper_test.go @@ -6,7 +6,6 @@ import ( coinbaseapi "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/apis/kraken" "github.com/skip-mev/slinky/providers/websockets/bybit" - coinbasews "github.com/skip-mev/slinky/providers/websockets/coinbase" "github.com/skip-mev/slinky/providers/websockets/huobi" "github.com/skip-mev/slinky/providers/websockets/kucoin" "github.com/skip-mev/slinky/providers/websockets/mexc" @@ -76,453 +75,137 @@ const dYdXResponseInvalid = ` } ` -var convertedResponse = mmtypes.GetMarketMapResponse{ +var usdtusd = slinkytypes.NewCurrencyPair("USDT", "USD") + +var convertedResponse = mmtypes.MarketMapResponse{ MarketMap: mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ + Markets: map[string]mmtypes.Market{ "BTC/USD": { - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Decimals: 5, - MinProviderCount: 3, - }, - "ETH/USD": { - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Decimals: 6, - MinProviderCount: 3, - }, - "USDT/USD": { - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Decimals: 9, - MinProviderCount: 3, - }, - }, - Providers: map[string]mmtypes.Providers{ - "BTC/USD": { - Providers: []mmtypes.ProviderConfig{ + Ticker: mmtypes.NewTicker("BTC", "USD", 5, 3), + ProviderConfigs: []mmtypes.ProviderConfig{ { - Name: binance.Name, - OffChainTicker: "BTCUSDT", + Name: binance.Name, + OffChainTicker: "BTCUSDT", + NormalizeByPair: &usdtusd, }, { - Name: bybit.Name, - OffChainTicker: "BTCUSDT", + Name: bybit.Name, + OffChainTicker: "BTCUSDT", + NormalizeByPair: &usdtusd, }, { Name: coinbaseapi.Name, OffChainTicker: "BTC-USD", }, { - Name: coinbasews.Name, - OffChainTicker: "BTC-USD", - }, - { - Name: huobi.Name, - OffChainTicker: "btcusdt", + Name: huobi.Name, + OffChainTicker: "btcusdt", + NormalizeByPair: &usdtusd, }, { Name: kraken.Name, OffChainTicker: "XXBTZUSD", }, { - Name: kucoin.Name, - OffChainTicker: "BTC-USDT", + Name: kucoin.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &usdtusd, }, { - Name: mexc.Name, - OffChainTicker: "BTCUSDT", + Name: mexc.Name, + OffChainTicker: "BTCUSDT", + NormalizeByPair: &usdtusd, }, { - Name: okx.Name, - OffChainTicker: "BTC-USDT", + Name: okx.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &usdtusd, }, }, }, "ETH/USD": { - Providers: []mmtypes.ProviderConfig{ + Ticker: mmtypes.NewTicker("ETH", "USD", 6, 3), + ProviderConfigs: []mmtypes.ProviderConfig{ { - Name: binance.Name, - OffChainTicker: "ETHUSDT", + Name: binance.Name, + OffChainTicker: "ETHUSDT", + NormalizeByPair: &usdtusd, }, { - Name: bybit.Name, - OffChainTicker: "ETHUSDT", + Name: bybit.Name, + OffChainTicker: "ETHUSDT", + NormalizeByPair: &usdtusd, }, { Name: coinbaseapi.Name, OffChainTicker: "ETH-USD", }, { - Name: coinbasews.Name, - OffChainTicker: "ETH-USD", - }, - { - Name: huobi.Name, - OffChainTicker: "ethusdt", + Name: huobi.Name, + OffChainTicker: "ethusdt", + NormalizeByPair: &usdtusd, }, { Name: kraken.Name, OffChainTicker: "XETHZUSD", }, { - Name: kucoin.Name, - OffChainTicker: "ETH-USDT", + Name: kucoin.Name, + OffChainTicker: "ETH-USDT", + NormalizeByPair: &usdtusd, }, { - Name: mexc.Name, - OffChainTicker: "ETHUSDT", + Name: mexc.Name, + OffChainTicker: "ETHUSDT", + NormalizeByPair: &usdtusd, }, { - Name: okx.Name, - OffChainTicker: "ETH-USDT", + Name: okx.Name, + OffChainTicker: "ETH-USDT", + NormalizeByPair: &usdtusd, }, }, }, "USDT/USD": { - Providers: []mmtypes.ProviderConfig{ + Ticker: mmtypes.NewTicker("USDT", "USD", 9, 3), + ProviderConfigs: []mmtypes.ProviderConfig{ { Name: binance.Name, OffChainTicker: "USDCUSDT", + Invert: true, }, { Name: bybit.Name, OffChainTicker: "USDCUSDT", + Invert: true, }, { Name: coinbaseapi.Name, OffChainTicker: "USDT-USD", }, { - Name: coinbasews.Name, - OffChainTicker: "USDT-USD", + Name: huobi.Name, + OffChainTicker: "ethusdt", + NormalizeByPair: &slinkytypes.CurrencyPair{Base: "ETH", Quote: "USD"}, + Invert: true, }, { Name: kraken.Name, OffChainTicker: "USDTZUSD", }, { - Name: okx.Name, - OffChainTicker: "USDC-USDT", - }, - }, - }, - }, - Paths: map[string]mmtypes.Paths{ - "BTC/USD": { - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: binance.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: bybit.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbaseapi.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbasews.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: huobi.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: kraken.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: kucoin.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: mexc.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, + Name: kucoin.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &slinkytypes.CurrencyPair{Base: "BTC", Quote: "USD"}, + Invert: true, }, { - Operations: []mmtypes.Operation{ - { - Provider: okx.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - }, - }, - "ETH/USD": { - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: binance.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: bybit.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbaseapi.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbasews.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: huobi.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: kraken.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: kucoin.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: mexc.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: okx.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - }, - }, - "USDT/USD": { - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: binance.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: true, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: bybit.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: true, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbaseapi.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbasews.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: huobi.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: true, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("ETH", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: kraken.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: kucoin.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: true, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: okx.Name, - CurrencyPair: slinkytypes.NewCurrencyPair("USDT", "USD"), - Invert: true, - }, - }, + Name: okx.Name, + OffChainTicker: "USDC-USDT", + Invert: true, }, }, }, }, - AggregationType: mmtypes.AggregationType_INDEX_PRICE_AGGREGATION, }, } diff --git a/providers/apis/dydx/parse.go b/providers/apis/dydx/parse.go new file mode 100644 index 000000000..e8305c5a2 --- /dev/null +++ b/providers/apis/dydx/parse.go @@ -0,0 +1,214 @@ +package dydx + +import ( + "encoding/json" + "fmt" + "strings" + + "go.uber.org/zap" + + slinkytypes "github.com/skip-mev/slinky/pkg/types" + "github.com/skip-mev/slinky/providers/apis/binance" + "github.com/skip-mev/slinky/providers/apis/coinbase" + dydxtypes "github.com/skip-mev/slinky/providers/apis/dydx/types" + "github.com/skip-mev/slinky/providers/apis/kraken" + "github.com/skip-mev/slinky/providers/volatile" + "github.com/skip-mev/slinky/providers/websockets/bitfinex" + "github.com/skip-mev/slinky/providers/websockets/bitstamp" + "github.com/skip-mev/slinky/providers/websockets/bybit" + "github.com/skip-mev/slinky/providers/websockets/cryptodotcom" + "github.com/skip-mev/slinky/providers/websockets/gate" + "github.com/skip-mev/slinky/providers/websockets/huobi" + "github.com/skip-mev/slinky/providers/websockets/kucoin" + "github.com/skip-mev/slinky/providers/websockets/mexc" + "github.com/skip-mev/slinky/providers/websockets/okx" + mmtypes "github.com/skip-mev/slinky/x/marketmap/types" +) + +// ProviderMapping is referencing the different providers that are supported by the dYdX market params. +// +// ref: https://github.com/dydxprotocol/v4-chain/blob/main/protocol/daemons/pricefeed/client/constants/exchange_common/exchange_id.go +var ProviderMapping = map[string]string{ + "Binance": binance.Name, + "BinanceUS": binance.Name, + "Bitfinex": bitfinex.Name, + "Kraken": kraken.Name, // We only support the API since the WebSocket has different pairs. + "Gate": gate.Name, + "Bitstamp": bitstamp.Name, + "Bybit": bybit.Name, + "CryptoCom": cryptodotcom.Name, + "Huobi": huobi.Name, + "Kucoin": kucoin.Name, + "Okx": okx.Name, + "Mexc": mexc.Name, + "CoinbasePro": coinbase.Name, + "TestVolatileExchange": volatile.Name, +} + +// ConvertMarketParamsToMarketMap converts a dYdX market params response to a slinky market map response. +func (h *APIHandler) ConvertMarketParamsToMarketMap( + params dydxtypes.QueryAllMarketParamsResponse, +) (mmtypes.MarketMapResponse, error) { + marketMap := mmtypes.MarketMap{ + Markets: make(map[string]mmtypes.Market), + } + + for _, market := range params.MarketParams { + ticker, err := h.CreateTickerFromMarket(market) + if err != nil { + h.logger.Error( + "failed to create ticker from market", + zap.String("market", market.Pair), + zap.Error(err), + ) + + return mmtypes.MarketMapResponse{}, fmt.Errorf("failed to create ticker from market: %w", err) + } + + var exchangeConfigJSON dydxtypes.ExchangeConfigJson + if err := json.Unmarshal([]byte(market.ExchangeConfigJson), &exchangeConfigJSON); err != nil { + h.logger.Error( + "failed to unmarshal exchange json config", + zap.String("ticker", ticker.String()), + zap.Error(err), + ) + + return mmtypes.MarketMapResponse{}, fmt.Errorf("failed to unmarshal exchange json config: %w", err) + } + + // Convert the exchange config JSON to a set of paths and providers. + providers, err := h.ConvertExchangeConfigJSON(exchangeConfigJSON) + if err != nil { + h.logger.Error( + "failed to convert exchange config json", + zap.String("ticker", ticker.String()), + zap.Error(err), + ) + + return mmtypes.MarketMapResponse{}, fmt.Errorf("failed to convert exchange config json: %w", err) + } + + marketMap.Markets[ticker.String()] = mmtypes.Market{ + Ticker: ticker, + ProviderConfigs: providers, + } + } + + if err := marketMap.ValidateBasic(); err != nil { + return mmtypes.MarketMapResponse{}, fmt.Errorf("failed to validate market map: %w", err) + } + + return mmtypes.MarketMapResponse{ + MarketMap: marketMap, + }, nil +} + +// CreateTickerFromMarket creates a ticker from a dYdX market. +func (h *APIHandler) CreateTickerFromMarket(market dydxtypes.MarketParam) (mmtypes.Ticker, error) { + cp, err := h.CreateCurrencyPairFromPair(market.Pair) + if err != nil { + return mmtypes.Ticker{}, err + } + + t := mmtypes.Ticker{ + CurrencyPair: cp, + Decimals: uint64(market.Exponent * -1), + MinProviderCount: uint64(market.MinExchanges), + } + + return t, t.ValidateBasic() +} + +// CreateCurrencyPairFromMarket creates a currency pair from a dYdX market. +func (h *APIHandler) CreateCurrencyPairFromPair(pair string) (slinkytypes.CurrencyPair, error) { + split := strings.Split(pair, Delimeter) + if len(split) != 2 { + return slinkytypes.CurrencyPair{}, fmt.Errorf("expected pair (%s) to have 2 elements, got %d", pair, len(split)) + } + + cp := slinkytypes.NewCurrencyPair( + strings.ToUpper(split[0]), // Base + strings.ToUpper(split[1]), // Quote + ) + + return cp, cp.ValidateBasic() +} + +// ConvertExchangeConfigJSON creates a set of paths and providers for a given ticker +// from a dYdX market. These paths represent the different ways to convert a currency +// pair using the dYdX market. +func (h *APIHandler) ConvertExchangeConfigJSON( + config dydxtypes.ExchangeConfigJson, +) ([]mmtypes.ProviderConfig, error) { + var ( + providers = make([]mmtypes.ProviderConfig, 0, len(config.Exchanges)) + seen = make(map[dydxtypes.ExchangeMarketConfigJson]struct{}) + ) + + for _, cfg := range config.Exchanges { + // Ignore duplicates. + if _, ok := seen[cfg]; ok { + continue + } + seen[cfg] = struct{}{} + + // This means we have seen an exchange that slinky cannot support. + exchange, ok := ProviderMapping[cfg.ExchangeName] + if !ok { + // ignore unsupported exchanges + h.logger.Error( + "skipping unsupported exchange", + zap.String("exchange", cfg.ExchangeName), + zap.String("ticker", cfg.Ticker), + ) + + continue + } + + // Determine if the exchange needs to have an normalizeByPair. + var normalizeByPair *slinkytypes.CurrencyPair + if len(cfg.AdjustByMarket) > 0 { + temp, err := h.CreateCurrencyPairFromPair(cfg.AdjustByMarket) + if err != nil { + return nil, fmt.Errorf( + "failed to create normalize by pair for %s: %w", + cfg.AdjustByMarket, + err, + ) + } + + normalizeByPair = &temp + } + + // Convert to a provider config. + providers = append(providers, mmtypes.ProviderConfig{ + Name: exchange, + OffChainTicker: ConvertDenomByProvider(cfg.Ticker, exchange), // Convert the ticker to the provider's format. + Invert: cfg.Invert, + NormalizeByPair: normalizeByPair, + }) + } + + return providers, nil +} + +// ConvertDenomByProvider converts a given denom to a format that is compatible with a given provider. +// Specifically, this is used to convert API to WebSocket representations of denoms where necessary. +func ConvertDenomByProvider(denom string, exchange string) string { + switch { + case exchange == mexc.Name: + if strings.Contains(denom, "_") { + return strings.ReplaceAll(denom, "_", "") + } + + return denom + case exchange == bitstamp.Name: + if strings.Contains(denom, "/") { + return strings.ToLower(strings.ReplaceAll(denom, "/", "")) + } + + return strings.ToLower(denom) + default: + return denom + } +} diff --git a/providers/apis/dydx/utils_test.go b/providers/apis/dydx/parse_test.go similarity index 54% rename from providers/apis/dydx/utils_test.go rename to providers/apis/dydx/parse_test.go index 40faaba04..cbc352ccd 100644 --- a/providers/apis/dydx/utils_test.go +++ b/providers/apis/dydx/parse_test.go @@ -7,13 +7,12 @@ import ( "go.uber.org/zap" - "github.com/skip-mev/slinky/oracle/constants" slinkytypes "github.com/skip-mev/slinky/pkg/types" coinbaseapi "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/apis/dydx" dydxtypes "github.com/skip-mev/slinky/providers/apis/dydx/types" - coinbasews "github.com/skip-mev/slinky/providers/websockets/coinbase" "github.com/skip-mev/slinky/providers/websockets/kucoin" + "github.com/skip-mev/slinky/providers/websockets/mexc" "github.com/skip-mev/slinky/providers/websockets/okx" mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) @@ -22,18 +21,15 @@ func TestConvertMarketParamsToMarketMap(t *testing.T) { testCases := []struct { name string params dydxtypes.QueryAllMarketParamsResponse - expected mmtypes.GetMarketMapResponse + expected mmtypes.MarketMapResponse err bool }{ { name: "empty market params", params: dydxtypes.QueryAllMarketParamsResponse{}, - expected: mmtypes.GetMarketMapResponse{ + expected: mmtypes.MarketMapResponse{ MarketMap: mmtypes.MarketMap{ - Tickers: make(map[string]mmtypes.Ticker), - Providers: make(map[string]mmtypes.Providers), - Paths: make(map[string]mmtypes.Paths), - AggregationType: mmtypes.AggregationType_INDEX_PRICE_AGGREGATION, + Markets: make(map[string]mmtypes.Market), }, }, err: false, @@ -69,28 +65,27 @@ func TestConvertMarketParamsToMarketMap(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - resp, err := dydx.ConvertMarketParamsToMarketMap(tc.params, zap.NewNop()) + handler, err := dydx.NewAPIHandler(zap.NewNop(), dydx.DefaultAPIConfig) + require.NoError(t, err) + + resp, err := handler.ConvertMarketParamsToMarketMap(tc.params) if tc.err { require.Error(t, err) } else { require.NoError(t, err) - require.Equal(t, len(tc.expected.MarketMap.Tickers), len(resp.MarketMap.Tickers)) - require.Equal(t, tc.expected.MarketMap.Tickers, resp.MarketMap.Tickers) - - require.Equal(t, len(tc.expected.MarketMap.Providers), len(resp.MarketMap.Providers)) - require.Equal(t, tc.expected.MarketMap.Providers, resp.MarketMap.Providers) - - require.Equal(t, len(tc.expected.MarketMap.Paths), len(resp.MarketMap.Paths)) - require.Equal(t, tc.expected.MarketMap.Paths, resp.MarketMap.Paths) + require.Equal(t, tc.expected, resp) } }) } } func TestCreateCurrencyPairFromMarket(t *testing.T) { + handler, err := dydx.NewAPIHandler(zap.NewNop(), dydx.DefaultAPIConfig) + require.NoError(t, err) + t.Run("good ticker", func(t *testing.T) { pair := "BTC-USD" - cp, err := dydx.CreateCurrencyPairFromPair(pair) + cp, err := handler.CreateCurrencyPairFromPair(pair) require.NoError(t, err) require.Equal(t, cp.Base, "BTC") require.Equal(t, cp.Quote, "USD") @@ -98,13 +93,13 @@ func TestCreateCurrencyPairFromMarket(t *testing.T) { t.Run("bad ticker", func(t *testing.T) { pair := "BTCUSD" - _, err := dydx.CreateCurrencyPairFromPair(pair) + _, err := handler.CreateCurrencyPairFromPair(pair) require.Error(t, err) }) t.Run("lower casing still corrects", func(t *testing.T) { pair := "btc-usd" - cp, err := dydx.CreateCurrencyPairFromPair(pair) + cp, err := handler.CreateCurrencyPairFromPair(pair) require.NoError(t, err) require.Equal(t, cp.Base, "BTC") require.Equal(t, cp.Quote, "USD") @@ -166,7 +161,10 @@ func TestCreateTickerFromMarket(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - ticker, err := dydx.CreateTickerFromMarket(tc.market) + handler, err := dydx.NewAPIHandler(zap.NewNop(), dydx.DefaultAPIConfig) + require.NoError(t, err) + + ticker, err := handler.CreateTickerFromMarket(tc.market) if tc.err { require.Error(t, err) } else { @@ -180,19 +178,12 @@ func TestCreateTickerFromMarket(t *testing.T) { func TestConvertExchangeConfigJSON(t *testing.T) { testCases := []struct { name string - ticker mmtypes.Ticker config dydxtypes.ExchangeConfigJson - expectedPaths mmtypes.Paths - expectedProviders mmtypes.Providers + expectedProviders []mmtypes.ProviderConfig expectedErr bool }{ { name: "handles duplicate configs", - ticker: mmtypes.Ticker{ - CurrencyPair: slinkytypes.NewCurrencyPair("BTC", "USD"), - Decimals: 8, - MinProviderCount: 3, - }, config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -205,45 +196,16 @@ func TestConvertExchangeConfigJSON(t *testing.T) { }, }, }, - expectedPaths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: coinbaseapi.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbasews.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - }, - }, - }, - }, - expectedProviders: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{ - { - Name: coinbaseapi.Name, - OffChainTicker: "BTC-USD", - }, - { - Name: coinbasews.Name, - OffChainTicker: "BTC-USD", - }, + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: coinbaseapi.Name, + OffChainTicker: "BTC-USD", }, }, expectedErr: false, }, { - name: "single direct path with no inversion", - ticker: constants.BITCOIN_USD, + name: "single direct path with no inversion", config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -252,45 +214,16 @@ func TestConvertExchangeConfigJSON(t *testing.T) { }, }, }, - expectedPaths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: coinbaseapi.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbasews.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - }, - }, - }, - }, - expectedProviders: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{ - { - Name: coinbaseapi.Name, - OffChainTicker: "BTC-USD", - }, - { - Name: coinbasews.Name, - OffChainTicker: "BTC-USD", - }, + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: coinbaseapi.Name, + OffChainTicker: "BTC-USD", }, }, expectedErr: false, }, { - name: "single direct path with inversion", - ticker: constants.USDT_USD, + name: "single direct path with inversion", config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -300,32 +233,17 @@ func TestConvertExchangeConfigJSON(t *testing.T) { }, }, }, - expectedPaths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: okx.Name, - CurrencyPair: constants.USDT_USD.CurrencyPair, - Invert: true, - }, - }, - }, - }, - }, - expectedProviders: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{ - { - Name: okx.Name, - OffChainTicker: "USDC-USDT", - }, + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: okx.Name, + OffChainTicker: "USDC-USDT", + Invert: true, }, }, expectedErr: false, }, { - name: "single indirect path with an adjustable market", - ticker: constants.BITCOIN_USD, + name: "single indirect path with an adjustable market", config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -335,37 +253,20 @@ func TestConvertExchangeConfigJSON(t *testing.T) { }, }, }, - expectedPaths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: okx.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: constants.USDT_USD.CurrencyPair, - Invert: false, - }, - }, - }, - }, - }, - expectedProviders: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{ - { - Name: okx.Name, - OffChainTicker: "BTC-USDT", + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: okx.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, expectedErr: false, }, { - name: "single indirect path with an adjustable market and inversion that does not match the ticker", - ticker: constants.USDT_USD, + name: "single indirect path with an adjustable market and inversion that does not match the ticker", config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -376,32 +277,21 @@ func TestConvertExchangeConfigJSON(t *testing.T) { }, }, }, - expectedPaths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: kucoin.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: true, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - }, + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: kucoin.Name, + OffChainTicker: "BTC-USDT", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "BTC", + Quote: "USD", }, + Invert: true, }, }, - expectedProviders: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{}, - }, expectedErr: false, }, { - name: "invalid adjust by market", - ticker: constants.BITCOIN_USD, + name: "invalid adjust by market", config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -411,13 +301,11 @@ func TestConvertExchangeConfigJSON(t *testing.T) { }, }, }, - expectedPaths: mmtypes.Paths{}, - expectedProviders: mmtypes.Providers{}, + expectedProviders: []mmtypes.ProviderConfig{}, expectedErr: true, }, { - name: "invalid exchange name", - ticker: constants.BITCOIN_USD, + name: "invalid exchange name - should ignore", config: dydxtypes.ExchangeConfigJson{ Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { @@ -425,53 +313,37 @@ func TestConvertExchangeConfigJSON(t *testing.T) { Ticker: "BTC-USD", }, { - ExchangeName: "CoinbasePro", - Ticker: "BTC-USD", - AdjustByMarket: "USDT-USD", + ExchangeName: "CoinbasePro", + Ticker: "BTC-USD", }, }, }, - expectedPaths: mmtypes.Paths{ - Paths: []mmtypes.Path{ - { - Operations: []mmtypes.Operation{ - { - Provider: coinbaseapi.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: constants.USDT_USD.CurrencyPair, - Invert: false, - }, - }, - }, - { - Operations: []mmtypes.Operation{ - { - Provider: coinbasews.Name, - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Invert: false, - }, - { - Provider: mmtypes.IndexPrice, - CurrencyPair: constants.USDT_USD.CurrencyPair, - Invert: false, - }, - }, - }, + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: coinbaseapi.Name, + OffChainTicker: "BTC-USD", }, }, - expectedProviders: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{ + expectedErr: false, + }, + { + name: "exchange that includes a denom that needs to be converted", + config: dydxtypes.ExchangeConfigJson{ + Exchanges: []dydxtypes.ExchangeMarketConfigJson{ { - Name: coinbaseapi.Name, - OffChainTicker: "BTC-USD", + ExchangeName: "Mexc", + Ticker: "ETH_USDT", + AdjustByMarket: "USDT-USD", }, - { - Name: coinbasews.Name, - OffChainTicker: "BTC-USD", + }, + }, + expectedProviders: []mmtypes.ProviderConfig{ + { + Name: mexc.Name, + OffChainTicker: "ETHUSDT", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, }, }, @@ -481,19 +353,18 @@ func TestConvertExchangeConfigJSON(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - paths, providers, err := dydx.ConvertExchangeConfigJSON(tc.ticker, tc.config, zap.NewNop()) + handler, err := dydx.NewAPIHandler(zap.NewNop(), dydx.DefaultAPIConfig) + require.NoError(t, err) + + providers, err := handler.ConvertExchangeConfigJSON(tc.config) if tc.expectedErr { require.Error(t, err) return } - require.Equal(t, len(tc.expectedPaths.Paths), len(paths.Paths)) - require.Equal(t, len(tc.expectedProviders.Providers), len(providers.Providers)) + require.Equal(t, len(tc.expectedProviders), len(providers)) - if len(tc.expectedPaths.Paths) > 0 { - require.Equal(t, tc.expectedPaths, paths) - } - if len(tc.expectedProviders.Providers) > 0 { + if len(tc.expectedProviders) > 0 { require.Equal(t, tc.expectedProviders, providers) } }) diff --git a/providers/apis/dydx/utils.go b/providers/apis/dydx/utils.go index c3affa77a..984e4e52e 100644 --- a/providers/apis/dydx/utils.go +++ b/providers/apis/dydx/utils.go @@ -1,31 +1,9 @@ package dydx import ( - "encoding/json" - "fmt" - "strings" "time" - "go.uber.org/zap" - "github.com/skip-mev/slinky/oracle/config" - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/providers/apis/binance" - coinbaseapi "github.com/skip-mev/slinky/providers/apis/coinbase" - dydxtypes "github.com/skip-mev/slinky/providers/apis/dydx/types" - "github.com/skip-mev/slinky/providers/apis/kraken" - "github.com/skip-mev/slinky/providers/volatile" - "github.com/skip-mev/slinky/providers/websockets/bitfinex" - "github.com/skip-mev/slinky/providers/websockets/bitstamp" - "github.com/skip-mev/slinky/providers/websockets/bybit" - coinbasews "github.com/skip-mev/slinky/providers/websockets/coinbase" - "github.com/skip-mev/slinky/providers/websockets/cryptodotcom" - "github.com/skip-mev/slinky/providers/websockets/gate" - "github.com/skip-mev/slinky/providers/websockets/huobi" - "github.com/skip-mev/slinky/providers/websockets/kucoin" - "github.com/skip-mev/slinky/providers/websockets/mexc" - "github.com/skip-mev/slinky/providers/websockets/okx" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) const ( @@ -33,7 +11,7 @@ const ( Name = "dydx_api" // ChainID is the chain ID for the dYdX market map provider. - ChainID = "dydx-mainnet-1" + ChainID = "dydx-node" // Endpoint is the endpoint for the dYdX market map API. Endpoint = "%s/dydxprotocol/prices/params/market?limit=10000" @@ -53,300 +31,3 @@ var DefaultAPIConfig = config.APIConfig{ MaxQueries: 1, URL: "localhost:1317", } - -// ProviderMapping is referencing the different providers that are supported by the dYdX market params. -// -// ref: https://github.com/dydxprotocol/v4-chain/blob/main/protocol/daemons/pricefeed/client/constants/exchange_common/exchange_id.go -var ProviderMapping = map[string][]string{ - "Binance": {binance.Name}, - "BinanceUS": {binance.Name}, - "Bitfinex": {bitfinex.Name}, - "Kraken": {kraken.Name}, // We only support the API since the WebSocket has different pairs. - "Gate": {gate.Name}, - "Bitstamp": {bitstamp.Name}, - "Bybit": {bybit.Name}, - "CryptoCom": {cryptodotcom.Name}, - "Huobi": {huobi.Name}, - "Kucoin": {kucoin.Name}, - "Okx": {okx.Name}, - "Mexc": {mexc.Name}, - "CoinbasePro": {coinbaseapi.Name, coinbasews.Name}, // We support both the API and WebSocket. - "TestVolatileExchange": {volatile.Name}, -} - -// ConvertMarketParamsToMarketMap converts a dYdX market params response to a slinky market map response. -func ConvertMarketParamsToMarketMap(params dydxtypes.QueryAllMarketParamsResponse, logger *zap.Logger) (mmtypes.GetMarketMapResponse, error) { - marketMap := mmtypes.MarketMap{ - Tickers: make(map[string]mmtypes.Ticker), - Providers: make(map[string]mmtypes.Providers), - Paths: make(map[string]mmtypes.Paths), - AggregationType: mmtypes.AggregationType_INDEX_PRICE_AGGREGATION, - } - - for _, market := range params.MarketParams { - ticker, err := CreateTickerFromMarket(market) - if err != nil { - logger.Error("failed to create ticker from market", zap.Error(err)) - return mmtypes.GetMarketMapResponse{}, err - } - - var exchangeConfigJSON dydxtypes.ExchangeConfigJson - if err := json.Unmarshal([]byte(market.ExchangeConfigJson), &exchangeConfigJSON); err != nil { - return mmtypes.GetMarketMapResponse{}, fmt.Errorf("failed to unmarshal exchange json config for %s: %w", ticker.String(), err) - } - - // Convert the exchange config JSON to a set of paths and providers. - tickerPaths, tickerProviders, err := ConvertExchangeConfigJSON(ticker, exchangeConfigJSON, logger) - if err != nil { - return mmtypes.GetMarketMapResponse{}, fmt.Errorf("failed to convert exchange config json for %s: %w", ticker.String(), err) - } - - // Add the ticker, provider, and paths to the market map. - marketMap.Tickers[ticker.String()] = ticker - marketMap.Paths[ticker.String()] = tickerPaths - marketMap.Providers[ticker.String()] = tickerProviders - } - - if err := marketMap.ValidateBasic(); err != nil { - logger.Error("failed to validate market map", zap.Error(err)) - return mmtypes.GetMarketMapResponse{}, fmt.Errorf("failed to validate market map: %w", err) - } - - return mmtypes.GetMarketMapResponse{ - MarketMap: marketMap, - }, nil -} - -// CreateCurrencyPairFromMarket creates a currency pair from a dYdX market. -func CreateCurrencyPairFromPair(pair string) (slinkytypes.CurrencyPair, error) { - split := strings.Split(pair, Delimeter) - if len(split) != 2 { - return slinkytypes.CurrencyPair{}, fmt.Errorf("expected pair (%s) to have 2 elements, got %d", pair, len(split)) - } - - cp := slinkytypes.NewCurrencyPair( - strings.ToUpper(split[0]), // Base - strings.ToUpper(split[1]), // Quote - ) - - return cp, cp.ValidateBasic() -} - -// CreateTickerFromMarket creates a ticker from a dYdX market. -func CreateTickerFromMarket(market dydxtypes.MarketParam) (mmtypes.Ticker, error) { - cp, err := CreateCurrencyPairFromPair(market.Pair) - if err != nil { - return mmtypes.Ticker{}, err - } - - t := mmtypes.Ticker{ - CurrencyPair: cp, - Decimals: uint64(market.Exponent * -1), - MinProviderCount: uint64(market.MinExchanges), - } - - return t, t.ValidateBasic() -} - -// ConvertExchangeConfigJSON creates a set of paths and providers for a given ticker -// from a dYdX market. These paths represent the different ways to convert a currency -// pair using the dYdX market. -func ConvertExchangeConfigJSON( - ticker mmtypes.Ticker, - config dydxtypes.ExchangeConfigJson, - logger *zap.Logger, -) (mmtypes.Paths, mmtypes.Providers, error) { - var ( - paths []mmtypes.Path - providers []mmtypes.ProviderConfig - seen = make(map[dydxtypes.ExchangeMarketConfigJson]struct{}) - ) - - for _, cfg := range config.Exchanges { - // Ignore duplicates. - if _, ok := seen[cfg]; ok { - continue - } - seen[cfg] = struct{}{} - - // This means we have seen an exchange that slinky cannot support. - exchangeNames, ok := ProviderMapping[cfg.ExchangeName] - if !ok { - // ignore unsupported exchanges - logger.Error("unsupported exchange", zap.String("exchange", cfg.ExchangeName)) - continue - } - - var ( - exchangePaths []mmtypes.Path - err error - addProviders = true - ) - // Determine the relevant operations and provider configs based on the exchange config. - switch { - case len(cfg.AdjustByMarket) == 0 && !cfg.Invert: - exchangePaths = DirectConversion(ticker, exchangeNames) - case len(cfg.AdjustByMarket) == 0 && cfg.Invert: - exchangePaths = InvertedConversion(ticker, exchangeNames) - case len(cfg.AdjustByMarket) > 0 && !cfg.Invert: - exchangePaths, err = IndirectConversion(ticker, cfg, exchangeNames) - case len(cfg.AdjustByMarket) > 0 && cfg.Invert: - exchangePaths, err = IndirectInvertedConversion(cfg, exchangeNames) - addProviders = false - } - if err != nil { - return mmtypes.Paths{}, mmtypes.Providers{}, err - } - - // We only update the providers for a given ticker if the conversion includes the exchanges - // off-chain representation i.e. Case 1,2,3. - paths = append(paths, exchangePaths...) - if addProviders { - offChainTicker := ConvertDenomByProvider(cfg.Ticker, cfg.ExchangeName) - for _, name := range exchangeNames { - providers = append(providers, mmtypes.ProviderConfig{ - Name: name, - OffChainTicker: offChainTicker, - }) - } - } - - } - - return mmtypes.Paths{Paths: paths}, mmtypes.Providers{Providers: providers}, nil -} - -// DirectConversion is a conversion from market to desired ticker i.e. BTC/USD -> BTC/USD. -func DirectConversion( - ticker mmtypes.Ticker, - exchangeNames []string, -) []mmtypes.Path { - paths := make([]mmtypes.Path, len(exchangeNames)) - for i, name := range exchangeNames { - path := mmtypes.Path{ - Operations: []mmtypes.Operation{ - { - CurrencyPair: ticker.CurrencyPair, - Provider: name, - Invert: false, - }, - }, - } - paths[i] = path - } - return paths -} - -// InvertedConversion is a conversion with an inverted price i.e. USD/BTC ^ -1 = BTC/USD. -func InvertedConversion( - ticker mmtypes.Ticker, - exchangeNames []string, -) []mmtypes.Path { - paths := make([]mmtypes.Path, len(exchangeNames)) - for i, name := range exchangeNames { - path := mmtypes.Path{ - Operations: []mmtypes.Operation{ - { - CurrencyPair: ticker.CurrencyPair, - Provider: name, - Invert: true, - }, - }, - } - paths[i] = path - } - return paths -} - -// IndirectConversion is a conversion of two markets i.e. BTC/USDT * USDT/USD = BTC/USD. -func IndirectConversion( - ticker mmtypes.Ticker, - cfg dydxtypes.ExchangeMarketConfigJson, - exchangeNames []string, -) ([]mmtypes.Path, error) { - cp, err := CreateCurrencyPairFromPair(cfg.AdjustByMarket) - if err != nil { - return nil, err - } - - paths := make([]mmtypes.Path, len(exchangeNames)) - for i, name := range exchangeNames { - path := mmtypes.Path{ - Operations: []mmtypes.Operation{ - { - CurrencyPair: ticker.CurrencyPair, - Provider: name, - Invert: false, - }, - { - CurrencyPair: cp, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - } - paths[i] = path - } - - return paths, nil -} - -// IndirectInvertedConversion is a conversion of two markets to a desired ticker -// where the inverted quote of the first market and quote of the second market are used. -// i.e. BTC/USDT ^ -1 * BTC/USD = USDT/USD. -func IndirectInvertedConversion( - cfg dydxtypes.ExchangeMarketConfigJson, - exchangeNames []string, -) ([]mmtypes.Path, error) { - cp, err := CreateCurrencyPairFromPair(cfg.AdjustByMarket) - if err != nil { - return nil, err - } - - paths := make([]mmtypes.Path, len(exchangeNames)) - for i, name := range exchangeNames { - path := mmtypes.Path{ - Operations: []mmtypes.Operation{ - { - CurrencyPair: cp, - Provider: name, - Invert: true, - }, - { - CurrencyPair: cp, - Provider: mmtypes.IndexPrice, - Invert: false, - }, - }, - } - paths[i] = path - } - - return paths, nil -} - -// ConvertDenomByProvider converts a given denom to a format that is compatible with a given provider. -// Specifically, this is used to convert API to WebSocket representations of denoms where necessary. -func ConvertDenomByProvider(denom string, exchange string) string { - providers, ok := ProviderMapping[exchange] - if !ok { - return denom - } - - switch { - case len(providers) == 1 && providers[0] == mexc.Name: - if strings.Contains(denom, "_") { - return strings.ReplaceAll(denom, "_", "") - } - - return denom - case len(providers) == 1 && providers[0] == bitstamp.Name: - if strings.Contains(denom, "/") { - return strings.ToLower(strings.ReplaceAll(denom, "/", "")) - } - - return strings.ToLower(denom) - default: - return denom - } -} diff --git a/providers/apis/geckoterminal/api_handler.go b/providers/apis/geckoterminal/api_handler.go index 451f69860..582599a84 100644 --- a/providers/apis/geckoterminal/api_handler.go +++ b/providers/apis/geckoterminal/api_handler.go @@ -11,32 +11,22 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/pkg/math" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIDataHandler = (*APIHandler)(nil) // APIHandler implements the PriceAPIDataHandler interface for GeckoTerminal. type APIHandler struct { - // marketCfg is the config for the GeckoTerminal API. - market types.ProviderMarketMap // apiCfg is the config for the GeckoTerminal API. api config.APIConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewAPIHandler returns a new GeckoTerminal PriceAPIDataHandler. func NewAPIHandler( - market types.ProviderMarketMap, api config.APIConfig, ) (types.PriceAPIDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -50,8 +40,8 @@ func NewAPIHandler( } return &APIHandler{ - market: market, - api: api, + api: api, + cache: types.NewProviderTickers(), }, nil } @@ -59,20 +49,12 @@ func NewAPIHandler( // given tickers. Note that the GeckoTerminal API supports fetching multiple spot prices // iff they are all on the same chain. func (h *APIHandler) CreateURL( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) (string, error) { - if len(tickers) > MaxNumberOfTickers { - return "", fmt.Errorf("expected at most %d tickers, got %d", MaxNumberOfTickers, len(tickers)) - } - addresses := make([]string, len(tickers)) for i, ticker := range tickers { - cfg, ok := h.market.TickerConfigs[ticker] - if !ok { - return "", fmt.Errorf("no config for ticker %s", ticker.String()) - } - - addresses[i] = cfg.OffChainTicker + addresses[i] = ticker.GetOffChainTicker() + h.cache.Add(ticker) } return fmt.Sprintf(h.api.URL, strings.Join(addresses, ",")), nil @@ -82,13 +64,16 @@ func (h *APIHandler) CreateURL( // to contain multiple spot prices for a given token address. Note that all of the tokens // are shared on the same chain. func (h *APIHandler) ParseResponse( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, resp *http.Response, ) types.PriceResponse { // Parse the response. var result GeckoTerminalResponse if err := json.NewDecoder(resp.Body).Decode(&result); err != nil { - return types.NewPriceResponseWithErr(tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode)) + return types.NewPriceResponseWithErr( + tickers, + providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode), + ) } var ( @@ -99,35 +84,48 @@ func (h *APIHandler) ParseResponse( data := result.Data if data.Type != ExpectedResponseType { err := fmt.Errorf("expected type %s, got %s", ExpectedResponseType, data.Type) - return types.NewPriceResponseWithErr(tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorInvalidResponse)) + return types.NewPriceResponseWithErr( + tickers, + providertypes.NewErrorWithCode(err, providertypes.ErrorInvalidResponse), + ) } // Filter out the responses that are not expected. attributes := data.Attributes for address, price := range attributes.TokenPrices { - ticker, ok := h.market.OffChainMap[address] - err := fmt.Errorf("no ticker for address %s", address) + ticker, ok := h.cache.FromOffChainTicker(address) if !ok { - return types.NewPriceResponseWithErr(tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorUnknownPair)) + err := fmt.Errorf("no ticker for address %s", address) + return types.NewPriceResponseWithErr( + tickers, + providertypes.NewErrorWithCode(err, providertypes.ErrorUnknownPair), + ) } - // Convert the price to a big.Int. - price, err := math.Float64StringToBigInt(price, ticker.Decimals) + // Convert the price to a big.Float. + price, err := math.Float64StringToBigFloat(price) if err != nil { - wErr := fmt.Errorf("failed to convert price to big.Int: %w", err) + wErr := fmt.Errorf("failed to convert price to big.Float: %w", err) unresolved[ticker] = providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(wErr, providertypes.ErrorFailedToParsePrice), + ErrorWithCode: providertypes.NewErrorWithCode( + wErr, + providertypes.ErrorFailedToParsePrice, + ), } + continue } - resolved[ticker] = types.NewPriceResult(price, time.Now()) + resolved[ticker] = types.NewPriceResult(price, time.Now().UTC()) } // Add all expected tickers that did not return a response to the unresolved // map. for _, ticker := range tickers { - if _, resolvedOk := resolved[ticker]; !resolvedOk { + _, resolvedOk := resolved[ticker] + _, unresolvedOk := unresolved[ticker] + + if !resolvedOk && !unresolvedOk { err := fmt.Errorf("received no price response") unresolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorNoResponse), diff --git a/providers/apis/geckoterminal/api_handler_test.go b/providers/apis/geckoterminal/api_handler_test.go index e458e9f02..f764771b8 100644 --- a/providers/apis/geckoterminal/api_handler_test.go +++ b/providers/apis/geckoterminal/api_handler_test.go @@ -14,51 +14,42 @@ import ( "github.com/skip-mev/slinky/providers/apis/geckoterminal" "github.com/skip-mev/slinky/providers/base/testutils" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -var popcat = mmtypes.NewTicker("POPCAT", "USD", 8, 1) +var ( + mogusd = geckoterminal.DefaultETHMarketConfig.MustGetProviderTicker(constants.MOG_USD) + pepeusd = geckoterminal.DefaultETHMarketConfig.MustGetProviderTicker(constants.PEPE_USD) +) func TestCreateURL(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker url string expectedErr bool }{ { name: "valid", - cps: []mmtypes.Ticker{ - constants.MOG_USD, + cps: []types.ProviderTicker{ + mogusd, }, url: "https://api.geckoterminal.com/api/v2/simple/networks/eth/token_price/0xaaee1a9723aadb7afa2810263653a34ba2c21c7a", expectedErr: false, }, { name: "multiple currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + mogusd, + pepeusd, }, url: "https://api.geckoterminal.com/api/v2/simple/networks/eth/token_price/0xaaee1a9723aadb7afa2810263653a34ba2c21c7a,0x6982508145454Ce325dDbE47a25d4ec3d2311933", - expectedErr: true, - }, - { - name: "unknown currency", - cps: []mmtypes.Ticker{ - popcat, - }, - url: "", - expectedErr: true, + expectedErr: false, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(geckoterminal.Name, geckoterminal.DefaultETHMarketConfig) - require.NoError(t, err) - - h, err := geckoterminal.NewAPIHandler(marketConfig, geckoterminal.DefaultETHAPIConfig) + h, err := geckoterminal.NewAPIHandler(geckoterminal.DefaultETHAPIConfig) require.NoError(t, err) url, err := h.CreateURL(tc.cps) @@ -75,14 +66,14 @@ func TestCreateURL(t *testing.T) { func TestParseResponse(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker response *http.Response expected types.PriceResponse }{ { name: "valid", - cps: []mmtypes.Ticker{ - constants.MOG_USD, + cps: []types.ProviderTicker{ + mogusd, }, response: testutils.CreateResponseFromJSON( ` @@ -101,8 +92,8 @@ func TestParseResponse(t *testing.T) { ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.MOG_USD: { - Value: big.NewInt(957896146138), + mogusd: { + Value: big.NewFloat(0.000000957896146138212), }, }, types.UnResolvedPrices{}, @@ -110,7 +101,9 @@ func TestParseResponse(t *testing.T) { }, { name: "malformed response", - cps: []mmtypes.Ticker{constants.MOG_USD}, + cps: []types.ProviderTicker{ + mogusd, + }, response: testutils.CreateResponseFromJSON( ` { @@ -129,7 +122,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.MOG_USD: providertypes.UnresolvedResult{ + mogusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode( fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, @@ -138,7 +131,9 @@ func TestParseResponse(t *testing.T) { }, { name: "unable to parse float", - cps: []mmtypes.Ticker{constants.MOG_USD}, + cps: []types.ProviderTicker{ + mogusd, + }, response: testutils.CreateResponseFromJSON( ` { @@ -157,7 +152,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.MOG_USD: providertypes.UnresolvedResult{ + mogusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode( fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, @@ -166,7 +161,9 @@ func TestParseResponse(t *testing.T) { }, { name: "incorrect attribute", - cps: []mmtypes.Ticker{constants.MOG_USD}, + cps: []types.ProviderTicker{ + mogusd, + }, response: testutils.CreateResponseFromJSON( ` { @@ -185,7 +182,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.MOG_USD: providertypes.UnresolvedResult{ + mogusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode( fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, @@ -194,7 +191,9 @@ func TestParseResponse(t *testing.T) { }, { name: "unable to parse json", - cps: []mmtypes.Ticker{constants.MOG_USD}, + cps: []types.ProviderTicker{ + mogusd, + }, response: testutils.CreateResponseFromJSON( ` toms obvious but not minimal language @@ -203,7 +202,7 @@ toms obvious but not minimal language expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.MOG_USD: providertypes.UnresolvedResult{ + mogusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode( fmt.Errorf("bad format"), providertypes.ErrorAPIGeneral), }, @@ -212,9 +211,9 @@ toms obvious but not minimal language }, { name: "multiple currency pairs to parse response for", - cps: []mmtypes.Ticker{ - constants.MOG_USD, - constants.PEPE_USD, + cps: []types.ProviderTicker{ + mogusd, + pepeusd, }, response: testutils.CreateResponseFromJSON( ` @@ -234,11 +233,11 @@ toms obvious but not minimal language ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.MOG_USD: { - Value: big.NewInt(657896146138), + mogusd: { + Value: big.NewFloat(0.000000657896146138212), }, - constants.PEPE_USD: { - Value: big.NewInt(957896146138), + pepeusd: { + Value: big.NewFloat(0.000000957896146138212), }, }, types.UnResolvedPrices{}, @@ -248,10 +247,11 @@ toms obvious but not minimal language for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(geckoterminal.Name, geckoterminal.DefaultETHMarketConfig) + h, err := geckoterminal.NewAPIHandler(geckoterminal.DefaultETHAPIConfig) require.NoError(t, err) - h, err := geckoterminal.NewAPIHandler(marketConfig, geckoterminal.DefaultETHAPIConfig) + // Update the cache since it is assumed that createURL is executed before ParseResponse. + _, err = h.CreateURL(tc.cps) require.NoError(t, err) now := time.Now() @@ -263,7 +263,7 @@ toms obvious but not minimal language for cp, result := range tc.expected.Resolved { require.Contains(t, resp.Resolved, cp) r := resp.Resolved[cp] - require.Equal(t, result.Value, r.Value) + require.Equal(t, result.Value.SetPrec(18), r.Value.SetPrec(18)) require.True(t, r.Timestamp.After(now)) } diff --git a/providers/apis/geckoterminal/utils.go b/providers/apis/geckoterminal/utils.go index 441f035bd..f76b8a6aa 100644 --- a/providers/apis/geckoterminal/utils.go +++ b/providers/apis/geckoterminal/utils.go @@ -24,10 +24,6 @@ const ( // ExpectedResponseType is the expected attribute name for the response type in the // GeckoTerminal API response. ExpectedResponseType = "simple_token_price" - - // MaxNumberOfTickers is the maximum number of tickers that can be queried in a single - // request to the GeckoTerminal API. - MaxNumberOfTickers = 1 ) var ( @@ -38,7 +34,7 @@ var ( Atomic: false, Enabled: true, Timeout: 500 * time.Millisecond, - Interval: 5 * time.Second, + Interval: 20 * time.Second, ReconnectTimeout: 2000 * time.Millisecond, MaxQueries: 1, URL: ETH_URL, @@ -46,13 +42,11 @@ var ( // DefaultETHMarketConfig is the default market configuration for tokens on // Ethereum mainnet. - DefaultETHMarketConfig = types.TickerToProviderConfig{ + DefaultETHMarketConfig = types.CurrencyPairsToProviderTickers{ constants.MOG_USD: { - Name: Name, OffChainTicker: "0xaaee1a9723aadb7afa2810263653a34ba2c21c7a", }, constants.PEPE_USD: { - Name: Name, OffChainTicker: "0x6982508145454Ce325dDbE47a25d4ec3d2311933", }, } diff --git a/providers/apis/kraken/api_handler.go b/providers/apis/kraken/api_handler.go index 2c2237926..acef680f7 100644 --- a/providers/apis/kraken/api_handler.go +++ b/providers/apis/kraken/api_handler.go @@ -11,7 +11,6 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/pkg/math" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIDataHandler = (*APIHandler)(nil) @@ -20,25 +19,16 @@ var _ types.PriceAPIDataHandler = (*APIHandler)(nil) // for more information about the Kraken API, refer to the following link: // https://docs.kraken.com/rest/ type APIHandler struct { - // market is the config for the Kraken API. - market types.ProviderMarketMap // api is the config for the Kraken API. api config.APIConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewAPIHandler returns a new Kraken PriceAPIDataHandler. func NewAPIHandler( - market types.ProviderMarketMap, api config.APIConfig, ) (types.PriceAPIDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if api.Name != Name { return nil, fmt.Errorf("expected api config name %s, got %s", Name, api.Name) } @@ -52,24 +42,20 @@ func NewAPIHandler( } return &APIHandler{ - market: market, - api: api, + api: api, + cache: types.NewProviderTickers(), }, nil } // CreateURL returns the URL that is used to fetch data from the Kraken API for the // given tickers. func (h *APIHandler) CreateURL( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) (string, error) { var tickerStrings string for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return "", fmt.Errorf("ticker %s not found in market config", ticker.String()) - } - - tickerStrings += fmt.Sprintf("%s%s", market.OffChainTicker, Separator) + tickerStrings += fmt.Sprintf("%s%s", ticker.GetOffChainTicker(), Separator) + h.cache.Add(ticker) } if len(tickerStrings) == 0 { @@ -85,13 +71,14 @@ func (h *APIHandler) CreateURL( // ParseResponse parses the response from the Kraken API and returns a GetResponse. Each // of the tickers supplied will get a response or an error. func (h *APIHandler) ParseResponse( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, resp *http.Response, ) types.PriceResponse { // Parse the response into a ResponseBody. result, err := Decode(resp) if err != nil { - return types.NewPriceResponseWithErr(tickers, + return types.NewPriceResponseWithErr( + tickers, providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToDecode), ) } @@ -118,22 +105,29 @@ func (h *APIHandler) ParseResponse( for pair, resultTicker := range result.Tickers { resultTicker.pair = pair - - ticker, ok := h.market.OffChainMap[pair] + ticker, ok := h.cache.FromOffChainTicker(pair) if !ok { continue } - price, err := math.Float64StringToBigInt(resultTicker.LastPrice(), ticker.Decimals) + price, err := math.Float64StringToBigFloat(resultTicker.LastPrice()) if err != nil { - wErr := fmt.Errorf("failed to convert price %s to big.Int: %w", resultTicker.LastPrice(), err) + wErr := fmt.Errorf( + "failed to convert price %s to big.Float: %w", + resultTicker.LastPrice(), + err, + ) + unresolved[ticker] = providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(wErr, providertypes.ErrorFailedToParsePrice), + ErrorWithCode: providertypes.NewErrorWithCode( + wErr, + providertypes.ErrorFailedToParsePrice, + ), } continue } - resolved[ticker] = types.NewPriceResult(price, time.Now()) + resolved[ticker] = types.NewPriceResult(price, time.Now().UTC()) } // Add currency pairs that received no response to the unresolved map. @@ -143,7 +137,10 @@ func (h *APIHandler) ParseResponse( if !resolvedOk && !unresolvedOk { unresolved[ticker] = providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorNoResponse), + ErrorWithCode: providertypes.NewErrorWithCode( + fmt.Errorf("no response"), + providertypes.ErrorNoResponse, + ), } } } diff --git a/providers/apis/kraken/api_handler_test.go b/providers/apis/kraken/api_handler_test.go index 07440cb47..a69d31737 100644 --- a/providers/apis/kraken/api_handler_test.go +++ b/providers/apis/kraken/api_handler_test.go @@ -14,51 +14,50 @@ import ( "github.com/skip-mev/slinky/providers/apis/kraken" "github.com/skip-mev/slinky/providers/base/testutils" providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) -var mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) +var ( + btcusd = kraken.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + btcusdt = kraken.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = kraken.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + ethusd = kraken.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) +) func TestCreateURL(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker url string expectedErr bool }{ + { + name: "empty", + cps: []types.ProviderTicker{}, + url: "", + expectedErr: true, + }, { name: "valid single", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, url: "https://api.kraken.com/0/public/Ticker?pair=XBTUSDT", expectedErr: false, }, { name: "valid multiple", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, url: "https://api.kraken.com/0/public/Ticker?pair=XBTUSDT,ETHUSDT", expectedErr: false, }, - { - name: "unknown currency", - cps: []mmtypes.Ticker{ - mogusd, - }, - url: "", - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(kraken.Name, kraken.DefaultMarketConfig) - require.NoError(t, err) - - h, err := kraken.NewAPIHandler(marketConfig, kraken.DefaultAPIConfig) + h, err := kraken.NewAPIHandler(kraken.DefaultAPIConfig) require.NoError(t, err) url, err := h.CreateURL(tc.cps) @@ -75,20 +74,22 @@ func TestCreateURL(t *testing.T) { func TestParseResponse(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker response *http.Response expected types.PriceResponse }{ { name: "valid single", - cps: []mmtypes.Ticker{constants.BITCOIN_USD}, + cps: []types.ProviderTicker{ + btcusd, + }, response: testutils.CreateResponseFromJSON( `{"error":[],"result":{"XXBTZUSD":{"a":["64587.50000","2","2.000"],"b":["64587.40000","11","11.000"],"c":["64587.40000","0.01026127"],"v":["5866.14264484","6251.33408493"],"p":["64487.45123","64670.54770"],"t":[56819,62596],"l":["62356.50000","62356.50000"],"h":["68075.00000","68075.00000"],"o":"67600.00000"}}}`, ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(6458740000000), + btcusd: { + Value: big.NewFloat(64587.4), }, }, types.UnResolvedPrices{}, @@ -96,46 +97,29 @@ func TestParseResponse(t *testing.T) { }, { name: "valid multiple", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, response: testutils.CreateResponseFromJSON( `{"error":[],"result":{"XETHZUSD":{"a":["3338.95000","1","1.000"],"b":["3338.94000","246","246.000"],"c":["3338.08000","0.00702654"],"v":["33234.61736920","35692.20596751"],"p":["3310.12909","3324.16514"],"t":[25646,28278],"l":["3200.17000","3200.17000"],"h":["3547.76000","3547.76000"],"o":"3518.43000"},"XXBTZUSD":{"a":["64547.20000","4","4.000"],"b":["64547.10000","15","15.000"],"c":["64547.20000","0.00013362"],"v":["5869.92462186","6253.84063618"],"p":["64487.50403","64670.01016"],"t":[56856,62595],"l":["62356.50000","62356.50000"],"h":["68075.00000","68075.00000"],"o":"67600.00000"}}}`, ), expected: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(6454720000000), + btcusd: { + Value: big.NewFloat(64547.2), }, - constants.ETHEREUM_USD: { - Value: big.NewInt(333808000000), + ethusd: { + Value: big.NewFloat(3338.08), }, }, types.UnResolvedPrices{}, ), }, - { - name: "unsupported currency", - cps: []mmtypes.Ticker{ - mogusd, - }, - response: testutils.CreateResponseFromJSON( - `{"error":[],"result":{"XXMOGUSD":{"a":["64587.50000","2","2.000"],"b":["64587.40000","11","11.000"],"c":["64587.40000","0.01026127"],"v":["5866.14264484","6251.33408493"],"p":["64487.45123","64670.54770"],"t":[56819,62596],"l":["62356.50000","62356.50000"],"h":["68075.00000","68075.00000"],"o":"67600.00000"}}}`, - ), - expected: types.NewPriceResponse( - types.ResolvedPrices{}, - types.UnResolvedPrices{ - mogusd: providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), - }, - }, - ), - }, { name: "bad response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, response: testutils.CreateResponseFromJSON( `shout out my label that's me`, @@ -143,7 +127,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), }, }, @@ -151,8 +135,8 @@ func TestParseResponse(t *testing.T) { }, { name: "bad price response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, response: testutils.CreateResponseFromJSON( `{"error":[],"result":{"XXBTZUSD":{"a":["$64587.50000","2","2.000"],"b":["$64587.40000","11","11.000"],"c":["$64587.40000","0.01026127"],"v":["5866.14264484","6251.33408493"],"p":["64487.45123","64670.54770"],"t":[56819,62596],"l":["62356.50000","62356.50000"],"h":["68075.00000","68075.00000"],"o":"67600.00000"}}}`, @@ -160,7 +144,7 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("invalid syntax"), providertypes.ErrorAPIGeneral), }, }, @@ -168,9 +152,9 @@ func TestParseResponse(t *testing.T) { }, { name: "no response", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, response: testutils.CreateResponseFromJSON( `[]`, @@ -178,10 +162,10 @@ func TestParseResponse(t *testing.T) { expected: types.NewPriceResponse( types.ResolvedPrices{}, types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), }, - constants.ETHEREUM_USDT: providertypes.UnresolvedResult{ + ethusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("no response"), providertypes.ErrorAPIGeneral), }, }, @@ -191,10 +175,11 @@ func TestParseResponse(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(kraken.Name, kraken.DefaultMarketConfig) + h, err := kraken.NewAPIHandler(kraken.DefaultAPIConfig) require.NoError(t, err) - h, err := kraken.NewAPIHandler(marketConfig, kraken.DefaultAPIConfig) + // Update the cache since it is assumed that createURL is executed before ParseResponse. + _, err = h.CreateURL(tc.cps) require.NoError(t, err) now := time.Now() @@ -206,7 +191,7 @@ func TestParseResponse(t *testing.T) { for cp, result := range tc.expected.Resolved { require.Contains(t, resp.Resolved, cp) r := resp.Resolved[cp] - require.Equal(t, result.Value, r.Value) + require.Equal(t, result.Value.SetPrec(18), r.Value.SetPrec(18)) require.True(t, r.Timestamp.After(now)) } diff --git a/providers/apis/kraken/utils.go b/providers/apis/kraken/utils.go index 973186126..fc7b05227 100644 --- a/providers/apis/kraken/utils.go +++ b/providers/apis/kraken/utils.go @@ -40,209 +40,158 @@ var ( } // DefaultMarketConfig is the default market configuration for Kraken. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USDT: { - Name: Name, OffChainTicker: "APEUSDT", }, constants.APTOS_USD: { - Name: Name, OffChainTicker: "APTUSD", }, constants.ARBITRUM_USD: { - Name: Name, OffChainTicker: "ARBUSD", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOMUSDT", }, constants.ATOM_USD: { - Name: Name, OffChainTicker: "ATOMUSD", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAXUSDT", }, constants.AVAX_USD: { - Name: Name, OffChainTicker: "AVAXUSD", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCHUSDT", }, constants.BCH_USD: { - Name: Name, OffChainTicker: "BCHUSD", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "XBTUSDC", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "XXBTZUSD", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "XBTUSDT", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADAUSDT", }, constants.CARDANO_USD: { - Name: Name, OffChainTicker: "ADAUSD", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINKUSDT", }, constants.CHAINLINK_USD: { - Name: Name, OffChainTicker: "LINKUSD", }, constants.COMPOUND_USD: { - Name: Name, OffChainTicker: "COMPUSD", }, constants.CURVE_USD: { - Name: Name, OffChainTicker: "CRVUSD", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "XDGUSDT", }, constants.DOGE_USD: { - Name: Name, OffChainTicker: "XDGUSD", }, constants.DYDX_USD: { - Name: Name, OffChainTicker: "DYDXUSD", }, constants.ETC_USD: { - Name: Name, OffChainTicker: "ETCUSD", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "XETHXXBT", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETHUSDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETHUSDT", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "XETHZUSD", }, constants.FILECOIN_USD: { - Name: Name, OffChainTicker: "FILUSD", }, constants.LIDO_USD: { - Name: Name, OffChainTicker: "LDOUSD", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTCUSDT", }, constants.LITECOIN_USD: { - Name: Name, OffChainTicker: "XLTCZUSD", }, constants.MAKER_USD: { - Name: Name, OffChainTicker: "MKRUSD", }, constants.NEAR_USD: { - Name: Name, OffChainTicker: "NEARUSD", }, constants.OPTIMISM_USD: { - Name: Name, OffChainTicker: "OPUSD", }, constants.PEPE_USD: { - Name: Name, OffChainTicker: "PEPEUSD", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOTUSDT", }, constants.POLKADOT_USD: { - Name: Name, OffChainTicker: "DOTUSD", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATICUSDT", }, constants.POLYGON_USD: { - Name: Name, OffChainTicker: "MATICUSD", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRPUSDT", }, constants.RIPPLE_USD: { - Name: Name, OffChainTicker: "XXRPZUSD", }, constants.SEI_USD: { - Name: Name, OffChainTicker: "SEIUSD", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIBUSDT", }, constants.SHIBA_USD: { - Name: Name, OffChainTicker: "SHIBUSD", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOLUSDT", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOLUSD", }, constants.STELLAR_USD: { - Name: Name, OffChainTicker: "XXLMZUSD", }, constants.SUI_USD: { - Name: Name, OffChainTicker: "SUIUSD", }, constants.TRON_USD: { - Name: Name, OffChainTicker: "TRXUSD", }, constants.UNISWAP_USD: { - Name: Name, OffChainTicker: "UNIUSD", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDCUSDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDTZUSD", }, } diff --git a/providers/apis/marketmap/api_handler.go b/providers/apis/marketmap/api_handler.go index 6721a9cca..5e0f0efa8 100644 --- a/providers/apis/marketmap/api_handler.go +++ b/providers/apis/marketmap/api_handler.go @@ -79,7 +79,7 @@ func (h *APIHandler) ParseResponse( } // Parse the response body into a market map object. - var market mmtypes.GetMarketMapResponse + var market mmtypes.MarketMapResponse if err := json.NewDecoder(resp.Body).Decode(&market); err != nil { return types.NewMarketMapResponseWithErr(chains, providertypes.NewErrorWithCode( @@ -111,6 +111,6 @@ func (h *APIHandler) ParseResponse( } resolved := make(types.ResolvedMarketMap) - resolved[chain] = types.NewMarketMapResult(&market, time.Now()) + resolved[chain] = types.NewMarketMapResult(&market, time.Now().UTC()) return types.NewMarketMapResponse(resolved, nil) } diff --git a/providers/apis/marketmap/api_handler_test.go b/providers/apis/marketmap/api_handler_test.go index 8753ad455..e083e11bf 100644 --- a/providers/apis/marketmap/api_handler_test.go +++ b/providers/apis/marketmap/api_handler_test.go @@ -9,6 +9,7 @@ import ( "github.com/stretchr/testify/require" "github.com/skip-mev/slinky/oracle/constants" + "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/apis/marketmap" "github.com/skip-mev/slinky/providers/base/testutils" providertypes "github.com/skip-mev/slinky/providers/types" @@ -27,15 +28,17 @@ var ( } goodMarketMap = mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]mmtypes.Providers{ + Markets: map[string]mmtypes.Market{ constants.BITCOIN_USD.String(): { - Providers: []mmtypes.ProviderConfig{ + Ticker: mmtypes.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, + MinProviderCount: 1, + }, + ProviderConfigs: []mmtypes.ProviderConfig{ { - Name: "coinbase", - OffChainTicker: "BTC/USD", + Name: coinbase.Name, + OffChainTicker: "BTC-USD", }, }, }, @@ -43,8 +46,14 @@ var ( } badMarketMap = mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, + Markets: map[string]mmtypes.Market{ + constants.BITCOIN_USD.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, + MinProviderCount: 3, + }, + }, }, } ) @@ -121,7 +130,7 @@ func TestParseResponse(t *testing.T) { name: "errors when the market map response is invalid", chains: chains[:1], resp: func() *http.Response { - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: badMarketMap, } @@ -142,7 +151,7 @@ func TestParseResponse(t *testing.T) { name: "returns a market map that does not match the chain id", chains: chains[:1], resp: func() *http.Response { - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: goodMarketMap, ChainId: "invalid", } @@ -164,7 +173,7 @@ func TestParseResponse(t *testing.T) { name: "returns a resolved market map", chains: chains[:1], resp: func() *http.Response { - resp := mmtypes.GetMarketMapResponse{ + resp := mmtypes.MarketMapResponse{ MarketMap: goodMarketMap, ChainId: chains[0].ChainID, } @@ -177,7 +186,7 @@ func TestParseResponse(t *testing.T) { expected: types.MarketMapResponse{ Resolved: types.ResolvedMarketMap{ chains[0]: types.MarketMapResult{ - Value: &mmtypes.GetMarketMapResponse{ + Value: &mmtypes.MarketMapResponse{ MarketMap: goodMarketMap, ChainId: chains[0].ChainID, }, diff --git a/providers/base/api/metrics/mocks/mock_metrics.go b/providers/base/api/metrics/mocks/mock_metrics.go index 2d71d4ad2..97628d1b7 100644 --- a/providers/base/api/metrics/mocks/mock_metrics.go +++ b/providers/base/api/metrics/mocks/mock_metrics.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.40.1. DO NOT EDIT. +// Code generated by mockery v2.42.2. DO NOT EDIT. package mocks @@ -22,9 +22,9 @@ func (_m *APIMetrics) AddHTTPStatusCode(providerName string, resp *http.Response _m.Called(providerName, resp) } -// AddProviderResponse provides a mock function with given fields: providerName, id, status -func (_m *APIMetrics) AddProviderResponse(providerName string, id string, status types.ErrorCode) { - _m.Called(providerName, id, status) +// AddProviderResponse provides a mock function with given fields: providerName, id, errorCode +func (_m *APIMetrics) AddProviderResponse(providerName string, id string, errorCode types.ErrorCode) { + _m.Called(providerName, id, errorCode) } // ObserveProviderResponseLatency provides a mock function with given fields: providerName, duration diff --git a/providers/factories/oracle/api.go b/providers/factories/oracle/api.go index 7debc10b6..323d37dd3 100644 --- a/providers/factories/oracle/api.go +++ b/providers/factories/oracle/api.go @@ -10,7 +10,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" "github.com/skip-mev/slinky/providers/apis/binance" coinbaseapi "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/providers/apis/coingecko" @@ -30,7 +29,6 @@ func APIQueryHandlerFactory( logger *zap.Logger, cfg config.ProviderConfig, metrics metrics.APIMetrics, - marketMap types.ProviderMarketMap, ) (types.PriceAPIQueryHandler, error) { // Validate the provider config. err := cfg.ValidateBasic() @@ -41,10 +39,8 @@ func APIQueryHandlerFactory( // Create the underlying client that will be used to fetch data from the API. This client // will limit the number of concurrent connections and uses the configured timeout to // ensure requests do not hang. - tickers := marketMap.GetTickers() - maxCons := math.Min(len(tickers), cfg.API.MaxQueries) client := &http.Client{ - Transport: &http.Transport{MaxConnsPerHost: maxCons}, + Transport: &http.Transport{MaxConnsPerHost: cfg.API.MaxQueries}, Timeout: cfg.API.Timeout, } @@ -60,15 +56,15 @@ func APIQueryHandlerFactory( switch cfg.Name { case binance.Name: - apiDataHandler, err = binance.NewAPIHandler(marketMap, cfg.API) + apiDataHandler, err = binance.NewAPIHandler(cfg.API) case coinbaseapi.Name: - apiDataHandler, err = coinbaseapi.NewAPIHandler(marketMap, cfg.API) + apiDataHandler, err = coinbaseapi.NewAPIHandler(cfg.API) case coingecko.Name: - apiDataHandler, err = coingecko.NewAPIHandler(marketMap, cfg.API) + apiDataHandler, err = coingecko.NewAPIHandler(cfg.API) case geckoterminal.Name: - apiDataHandler, err = geckoterminal.NewAPIHandler(marketMap, cfg.API) + apiDataHandler, err = geckoterminal.NewAPIHandler(cfg.API) case kraken.Name: - apiDataHandler, err = kraken.NewAPIHandler(marketMap, cfg.API) + apiDataHandler, err = kraken.NewAPIHandler(cfg.API) case uniswapv3.Name: var ethClient uniswapv3.EVMClient ethClient, err = uniswapv3.NewGoEthereumClientImpl(cfg.API.URL) @@ -76,24 +72,15 @@ func APIQueryHandlerFactory( return nil, err } - apiPriceFetcher, err = uniswapv3.NewPriceFetcher(logger, metrics, cfg.API, ethClient) + apiPriceFetcher, err = uniswapv3.NewPriceFetcher(logger, cfg.API, ethClient) case static.Name: - apiDataHandler, err = static.NewAPIHandler(marketMap) - if err != nil { - return nil, err - } - + apiDataHandler = static.NewAPIHandler() requestHandler = static.NewStaticMockClient() case volatile.Name: - apiDataHandler, err = volatile.NewAPIHandler(marketMap) - if err != nil { - return nil, err - } - + apiDataHandler = volatile.NewAPIHandler() requestHandler = static.NewStaticMockClient() case raydium.Name: apiPriceFetcher, err = raydium.NewAPIPriceFetcher( - marketMap, cfg.API, logger, ) diff --git a/providers/factories/oracle/factory.go b/providers/factories/oracle/factory.go deleted file mode 100644 index b9cf36ecf..000000000 --- a/providers/factories/oracle/factory.go +++ /dev/null @@ -1,124 +0,0 @@ -package oracle - -import ( - "fmt" - "math/big" - - "go.uber.org/zap" - - "github.com/skip-mev/slinky/oracle/config" - "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/providers/base" - apimetrics "github.com/skip-mev/slinky/providers/base/api/metrics" - providermetrics "github.com/skip-mev/slinky/providers/base/metrics" - wsmetrics "github.com/skip-mev/slinky/providers/base/websocket/metrics" - providertypes "github.com/skip-mev/slinky/providers/types" - "github.com/skip-mev/slinky/providers/types/factory" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" -) - -// DefaultOracleProviderFactory is a sample implementation of the provider factory. This provider -// factory function returns providers that are API & websocket based. -type DefaultOracleProviderFactory struct { - logger *zap.Logger - - // marketMap is the market map that is used to configure the providers. - marketMap mmtypes.MarketMap -} - -// NewDefaultProviderFactory returns a new instance of the default provider factory. -func NewDefaultProviderFactory( - logger *zap.Logger, - marketmap mmtypes.MarketMap, -) (*DefaultOracleProviderFactory, error) { - if logger == nil { - return nil, fmt.Errorf("logger cannot be nil") - } - - if err := marketmap.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market map: %w", err) - } - - return &DefaultOracleProviderFactory{ - logger: logger, - marketMap: marketmap, - }, nil -} - -// Factory returns a factory function that creates providers based on the oracle configuration. -func (f *DefaultOracleProviderFactory) Factory() factory.ProviderFactory[mmtypes.Ticker, *big.Int] { - return func(cfg config.OracleConfig) ([]providertypes.Provider[mmtypes.Ticker, *big.Int], error) { - if err := cfg.ValidateBasic(); err != nil { - return nil, err - } - - // Create the metrics that are used by the providers. - wsMetrics := wsmetrics.NewWebSocketMetricsFromConfig(cfg.Metrics) - apiMetrics := apimetrics.NewAPIMetricsFromConfig(cfg.Metrics) - providerMetrics := providermetrics.NewProviderMetricsFromConfig(cfg.Metrics) - - // Create the providers. - providers := make([]providertypes.Provider[mmtypes.Ticker, *big.Int], len(cfg.Providers)) - for i, p := range cfg.Providers { - // Create the providers relative market map. - providerMarketMap, err := types.ProviderMarketMapFromMarketMap(p.Name, f.marketMap) - if err != nil { - return nil, fmt.Errorf("failed to create %s's provider market map: %w", p.Name, err) - } - - f.logger.Info( - "market for provider has been created", - zap.Int("num_tickers", len(providerMarketMap.GetTickers())), - zap.String("provider", p.Name), - ) - - switch { - case p.API.Enabled: - queryHandler, err := APIQueryHandlerFactory(f.logger, p, apiMetrics, providerMarketMap) - if err != nil { - return nil, fmt.Errorf("failed to create %s's API query handler: %w", p.Name, err) - } - - // Create the provider. - provider, err := types.NewPriceProvider( - base.WithName[mmtypes.Ticker, *big.Int](p.Name), - base.WithLogger[mmtypes.Ticker, *big.Int](f.logger), - base.WithAPIQueryHandler(queryHandler), - base.WithAPIConfig[mmtypes.Ticker, *big.Int](p.API), - base.WithIDs[mmtypes.Ticker, *big.Int](providerMarketMap.GetTickers()), - base.WithMetrics[mmtypes.Ticker, *big.Int](providerMetrics), - ) - if err != nil { - return nil, fmt.Errorf("failed to create %s's provider: %w", p.Name, err) - } - - providers[i] = provider - case p.WebSocket.Enabled: - queryHandler, err := WebSocketQueryHandlerFactory(f.logger, p, wsMetrics, providerMarketMap) - if err != nil { - return nil, fmt.Errorf("failed to create %s's web socket query handler: %w", p.Name, err) - } - - // Create the provider. - provider, err := base.NewProvider[mmtypes.Ticker, *big.Int]( - base.WithName[mmtypes.Ticker, *big.Int](p.Name), - base.WithLogger[mmtypes.Ticker, *big.Int](f.logger), - base.WithWebSocketQueryHandler(queryHandler), - base.WithWebSocketConfig[mmtypes.Ticker, *big.Int](p.WebSocket), - base.WithIDs[mmtypes.Ticker, *big.Int](providerMarketMap.GetTickers()), - base.WithMetrics[mmtypes.Ticker, *big.Int](providerMetrics), - ) - if err != nil { - return nil, fmt.Errorf("failed to create %s's provider: %w", p.Name, err) - } - - providers[i] = provider - default: - f.logger.Info("unknown provider type", zap.String("provider", p.Name)) - return nil, fmt.Errorf("unknown provider type: %s", p.Name) - } - } - - return providers, nil - } -} diff --git a/providers/factories/oracle/marketmap.go b/providers/factories/oracle/marketmap.go index 8e697b883..a334de625 100644 --- a/providers/factories/oracle/marketmap.go +++ b/providers/factories/oracle/marketmap.go @@ -40,7 +40,7 @@ func MarketMapProviderFactory( switch cfg.Name { case dydx.Name: - apiDataHandler, err = dydx.NewAPIHandler(cfg.API, logger) + apiDataHandler, err = dydx.NewAPIHandler(logger, cfg.API) ids = []types.Chain{{ChainID: dydx.ChainID}} default: apiDataHandler, err = marketmap.NewAPIHandler(cfg.API) @@ -65,11 +65,11 @@ func MarketMapProviderFactory( } return types.NewMarketMapProvider( - base.WithName[types.Chain, *mmtypes.GetMarketMapResponse](cfg.Name), - base.WithLogger[types.Chain, *mmtypes.GetMarketMapResponse](logger), + base.WithName[types.Chain, *mmtypes.MarketMapResponse](cfg.Name), + base.WithLogger[types.Chain, *mmtypes.MarketMapResponse](logger), base.WithAPIQueryHandler(queryHandler), - base.WithAPIConfig[types.Chain, *mmtypes.GetMarketMapResponse](cfg.API), - base.WithMetrics[types.Chain, *mmtypes.GetMarketMapResponse](providerMetrics), - base.WithIDs[types.Chain, *mmtypes.GetMarketMapResponse](ids), + base.WithAPIConfig[types.Chain, *mmtypes.MarketMapResponse](cfg.API), + base.WithMetrics[types.Chain, *mmtypes.MarketMapResponse](providerMetrics), + base.WithIDs[types.Chain, *mmtypes.MarketMapResponse](ids), ) } diff --git a/providers/factories/oracle/websocket.go b/providers/factories/oracle/websocket.go index 4a00c1938..87ff68e4d 100644 --- a/providers/factories/oracle/websocket.go +++ b/providers/factories/oracle/websocket.go @@ -8,7 +8,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" apihandlers "github.com/skip-mev/slinky/providers/base/api/handlers" wshandlers "github.com/skip-mev/slinky/providers/base/websocket/handlers" wsmetrics "github.com/skip-mev/slinky/providers/base/websocket/metrics" @@ -32,7 +31,6 @@ func WebSocketQueryHandlerFactory( logger *zap.Logger, cfg config.ProviderConfig, wsMetrics wsmetrics.WebSocketMetrics, - marketMap types.ProviderMarketMap, ) (types.PriceWebSocketQueryHandler, error) { err := cfg.ValidateBasic() if err != nil { @@ -41,10 +39,8 @@ func WebSocketQueryHandlerFactory( // Create the underlying client that can be utilized by websocket providers that need to // interact with an API. - tickers := marketMap.GetTickers() - maxCons := math.Min(len(tickers), cfg.API.MaxQueries) client := &http.Client{ - Transport: &http.Transport{MaxConnsPerHost: maxCons}, + Transport: &http.Transport{MaxConnsPerHost: cfg.API.MaxQueries}, Timeout: cfg.API.Timeout, } @@ -56,24 +52,24 @@ func WebSocketQueryHandlerFactory( switch cfg.Name { case bitfinex.Name: - wsDataHandler, err = bitfinex.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = bitfinex.NewWebSocketDataHandler(logger, cfg.WebSocket) case bitstamp.Name: - wsDataHandler, err = bitstamp.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = bitstamp.NewWebSocketDataHandler(logger, cfg.WebSocket) case bybit.Name: - wsDataHandler, err = bybit.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = bybit.NewWebSocketDataHandler(logger, cfg.WebSocket) case coinbasews.Name: - wsDataHandler, err = coinbasews.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = coinbasews.NewWebSocketDataHandler(logger, cfg.WebSocket) case cryptodotcom.Name: - wsDataHandler, err = cryptodotcom.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = cryptodotcom.NewWebSocketDataHandler(logger, cfg.WebSocket) case gate.Name: - wsDataHandler, err = gate.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = gate.NewWebSocketDataHandler(logger, cfg.WebSocket) case huobi.Name: - wsDataHandler, err = huobi.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = huobi.NewWebSocketDataHandler(logger, cfg.WebSocket) case kraken.Name: - wsDataHandler, err = kraken.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = kraken.NewWebSocketDataHandler(logger, cfg.WebSocket) case kucoin.Name: // Create the KuCoin websocket data handler. - wsDataHandler, err = kucoin.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = kucoin.NewWebSocketDataHandler(logger, cfg.WebSocket) if err != nil { return nil, err } @@ -93,9 +89,9 @@ func WebSocketQueryHandlerFactory( wshandlers.WithPreDialHook(kucoin.PreDialHook(cfg.API, requestHandler)), ) case mexc.Name: - wsDataHandler, err = mexc.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = mexc.NewWebSocketDataHandler(logger, cfg.WebSocket) case okx.Name: - wsDataHandler, err = okx.NewWebSocketDataHandler(logger, marketMap, cfg.WebSocket) + wsDataHandler, err = okx.NewWebSocketDataHandler(logger, cfg.WebSocket) default: return nil, fmt.Errorf("unknown provider: %s", cfg.Name) } diff --git a/providers/static/api_handler.go b/providers/static/api_handler.go index f04f3ce95..89d548b6f 100644 --- a/providers/static/api_handler.go +++ b/providers/static/api_handler.go @@ -1,7 +1,6 @@ package static import ( - "fmt" "math/big" "net/http" "time" @@ -9,7 +8,6 @@ import ( providertypes "github.com/skip-mev/slinky/providers/types" "github.com/skip-mev/slinky/oracle/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceAPIDataHandler = (*MockAPIHandler)(nil) @@ -20,48 +18,24 @@ const ( ) // MockAPIHandler implements a mock API handler that returns static data. -type MockAPIHandler struct { - exchangeRates types.TickerPrices - tickers []mmtypes.Ticker -} +type MockAPIHandler struct{} // NewAPIHandler returns a new MockAPIHandler. This constructs a new static mock provider from // the config. Notice this method expects the market configuration map to the offchain ticker // to the desired price. -func NewAPIHandler( - market types.ProviderMarketMap, -) (types.PriceAPIDataHandler, error) { - if market.Name != Name { - return nil, fmt.Errorf("expected market config name to be %s, got %s", Name, market.Name) - } - - s := MockAPIHandler{ - exchangeRates: make(types.TickerPrices), - tickers: make([]mmtypes.Ticker, 0), - } - - for ticker, config := range market.TickerConfigs { - price, converted := big.NewInt(0).SetString(config.OffChainTicker, 10) - if !converted { - return nil, fmt.Errorf("failed to parse price %s for ticker %s", price, config.OffChainTicker) - } - - s.exchangeRates[ticker] = price - s.tickers = append(s.tickers, ticker) - } - - return &s, nil +func NewAPIHandler() types.PriceAPIDataHandler { + return &MockAPIHandler{} } // CreateURL is a no-op. -func (s *MockAPIHandler) CreateURL(_ []mmtypes.Ticker) (string, error) { +func (s *MockAPIHandler) CreateURL(_ []types.ProviderTicker) (string, error) { return "static-url", nil } // ParseResponse is a no-op. This simply returns the price of the tickers configured, // timestamped with the current time. func (s *MockAPIHandler) ParseResponse( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, _ *http.Response, ) types.PriceResponse { var ( @@ -70,12 +44,18 @@ func (s *MockAPIHandler) ParseResponse( ) for _, ticker := range tickers { - if price, ok := s.exchangeRates[ticker]; ok { - resolved[ticker] = types.NewPriceResult(price, time.Now()) + var metaData MetaData + if err := metaData.FromJSON(ticker.GetJSON()); err == nil { + resolved[ticker] = types.NewPriceResult( + big.NewFloat(metaData.Price), + time.Now().UTC(), + ) } else { - err := fmt.Errorf("failed to resolve ticker %s", ticker) unresolved[ticker] = providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorUnknownPair), + ErrorWithCode: providertypes.NewErrorWithCode( + err, + providertypes.ErrorFailedToParsePrice, + ), } } } diff --git a/providers/static/utils.go b/providers/static/utils.go new file mode 100644 index 000000000..84a20416b --- /dev/null +++ b/providers/static/utils.go @@ -0,0 +1,26 @@ +package static + +import ( + "encoding/json" + "fmt" +) + +// MetaData is the per-ticker specific metadata that is used to configure the static provider. +type MetaData struct { + Price float64 `json:"price"` +} + +// FromJSON unmarshals the JSON data into a MetaData struct. +func (m *MetaData) FromJSON(jsonStr string) error { + err := json.Unmarshal([]byte(jsonStr), m) + return err +} + +// MustToJSON marshals the MetaData struct into a JSON string. +func (m *MetaData) MustToJSON() string { + bz, err := json.Marshal(m) + if err != nil { + panic(fmt.Errorf("failed to marshal metadata: %w", err)) + } + return string(bz) +} diff --git a/providers/volatile/api_handler.go b/providers/volatile/api_handler.go index bde4e2af4..0da477a3e 100644 --- a/providers/volatile/api_handler.go +++ b/providers/volatile/api_handler.go @@ -1,15 +1,12 @@ package volatile import ( - "fmt" "net/http" "time" "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" - providertypes "github.com/skip-mev/slinky/providers/types" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) const ( @@ -35,48 +32,28 @@ var DefaultAPIConfig = config.APIConfig{ } // APIHandler implements the APIHandler interface. -type APIHandler struct { - tickers map[mmtypes.Ticker]bool -} +type APIHandler struct{} // NewAPIHandler is invoked by the API factory to create the volatile api handler. -func NewAPIHandler(market types.ProviderMarketMap) (types.PriceAPIDataHandler, error) { - if market.Name != Name { - return nil, fmt.Errorf("expected market config name to be %s, got %s", Name, market.Name) - } - v := APIHandler{ - tickers: make(map[mmtypes.Ticker]bool), - } - - for ticker := range market.TickerConfigs { - v.tickers[ticker] = true - } - return &v, nil +func NewAPIHandler() types.PriceAPIDataHandler { + return &APIHandler{} } // CreateURL is a no-op in volatile api handler. -func (v *APIHandler) CreateURL(_ []mmtypes.Ticker) (string, error) { +func (v *APIHandler) CreateURL(_ []types.ProviderTicker) (string, error) { return "volatile-exchange-url", nil } // ParseResponse returns the same volatile price for each ticker. -func (v *APIHandler) ParseResponse(tickers []mmtypes.Ticker, _ *http.Response) types.PriceResponse { +func (v *APIHandler) ParseResponse(tickers []types.ProviderTicker, _ *http.Response) types.PriceResponse { var ( resolved = make(types.ResolvedPrices) unresolved = make(types.UnResolvedPrices) ) volatilePrice := GetVolatilePrice(time.Now, Amplitude, Offset, Frequency) - for _, ticker := range tickers { - if _, ok := v.tickers[ticker]; ok { - resolved[ticker] = types.NewPriceResult(volatilePrice, time.Now()) - } else { - err := fmt.Errorf("failed to resolve ticker %s", ticker) - unresolved[ticker] = providertypes.UnresolvedResult{ - ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorUnknownPair), - } - } + resolved[ticker] = types.NewPriceResult(volatilePrice, time.Now().UTC()) } return types.NewPriceResponse(resolved, unresolved) diff --git a/providers/volatile/api_handler_test.go b/providers/volatile/api_handler_test.go index 8015fd2f4..888c7c024 100644 --- a/providers/volatile/api_handler_test.go +++ b/providers/volatile/api_handler_test.go @@ -7,25 +7,16 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/volatile" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - ticker1 = mmtypes.NewTicker("foo", "bar", 1, 1) - ticker2 = mmtypes.NewTicker("bar", "foo", 1, 1) + ticker1 = types.NewProviderTicker("foo/bar", "{}") + ticker2 = types.NewProviderTicker("foo/baz", "{}") ) func setupTest(t *testing.T) types.PriceAPIDataHandler { t.Helper() - ttpc := make(map[mmtypes.Ticker]mmtypes.ProviderConfig) - ttpc[ticker1] = mmtypes.ProviderConfig{ - Name: volatile.Name, - OffChainTicker: ticker1.String(), - } - pmm, err := types.NewProviderMarketMap(volatile.Name, ttpc) - require.NoError(t, err) - h, err := volatile.NewAPIHandler(pmm) - require.NoError(t, err) + h := volatile.NewAPIHandler() return h } @@ -38,8 +29,7 @@ func TestCreateURL(t *testing.T) { func TestParseResponse(t *testing.T) { volatileHandler := setupTest(t) - resp := volatileHandler.ParseResponse([]mmtypes.Ticker{ticker1, ticker2}, nil) - require.Equal(t, 1, len(resp.Resolved)) - require.Equal(t, 1, len(resp.UnResolved)) + resp := volatileHandler.ParseResponse([]types.ProviderTicker{ticker1, ticker2}, nil) + require.Equal(t, 2, len(resp.Resolved)) require.NotNilf(t, resp.Resolved[ticker1], "did not receive a response for ticker1") } diff --git a/providers/volatile/price.go b/providers/volatile/price.go index 38bd0f7d8..8f657bbe5 100644 --- a/providers/volatile/price.go +++ b/providers/volatile/price.go @@ -22,7 +22,7 @@ var ( // - cosVal = math.Cos(radians) // - radians = (cosinePhase <= 0.5 ? cosinePhase * 4 : cosinePhase * 4 - 1) * Ï€ // - cosinePhase = (frequency * unix_time(in seconds) / dailySeconds) % 1. -func GetVolatilePrice(tp TimeProvider, amplitude float64, offset float64, frequency float64) *big.Int { +func GetVolatilePrice(tp TimeProvider, amplitude float64, offset float64, frequency float64) *big.Float { // The phase is the location of the final price within our repeating price function. // The resulting value is taken mod(1) i.e. it is between 0 and 1 inclusive cosinePhase := math.Mod( @@ -36,6 +36,5 @@ func GetVolatilePrice(tp TimeProvider, amplitude float64, offset float64, freque } radians *= math.Pi cosVal := math.Cos(radians) - price, _ := big.NewFloat(offset * (1 + amplitude*cosVal)).Int(nil) - return price + return big.NewFloat(offset * (1 + amplitude*cosVal)) } diff --git a/providers/volatile/price_test.go b/providers/volatile/price_test.go index aa3d7c1ed..6ab097b4d 100644 --- a/providers/volatile/price_test.go +++ b/providers/volatile/price_test.go @@ -19,68 +19,68 @@ func TestGetVolatilePrice(t *testing.T) { amplitude float64 offset float64 frequency float64 - expectedPrice *big.Int + expectedPrice *big.Float }{ { name: "test cosinePhase 0", tp: func() time.Time { return time.Unix(0, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(195), + expectedPrice: big.NewFloat(195), }, { name: "test cosinePhase .25", tp: func() time.Time { return time.Unix(25*dailySeconds/100, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(5), + expectedPrice: big.NewFloat(5.000000000000004), }, { name: "test cosinePhase .26", tp: func() time.Time { return time.Unix(26*dailySeconds/100, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(5), + expectedPrice: big.NewFloat(5.749103375124606), }, { name: "test cosinePhase .5", tp: func() time.Time { return time.Unix(50*dailySeconds/100, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(195), + expectedPrice: big.NewFloat(195), }, { name: "test cosinePhase .51", tp: func() time.Time { return time.Unix(51*dailySeconds/100, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(5), + expectedPrice: big.NewFloat(5.749103375124606), }, { name: "test cosinePhase .80", tp: func() time.Time { return time.Unix(80*dailySeconds/100, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(176), + expectedPrice: big.NewFloat(176.85661446561997), }, { name: "test cosinePhase .99", tp: func() time.Time { return time.Unix(99*dailySeconds/100, 0) }, - amplitude: float64(0.95), + amplitude: 0.95, offset: float64(100), frequency: float64(1), - expectedPrice: big.NewInt(5), + expectedPrice: big.NewFloat(5.749103375124606), }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.expectedPrice, volatile.GetVolatilePrice(tc.tp, tc.amplitude, tc.offset, tc.frequency)) + require.Equal(t, tc.expectedPrice.SetPrec(40), volatile.GetVolatilePrice(tc.tp, tc.amplitude, tc.offset, tc.frequency).SetPrec(40)) }) } } diff --git a/providers/websockets/bitfinex/parse.go b/providers/websockets/bitfinex/parse.go index 287eb750d..db4954e4c 100644 --- a/providers/websockets/bitfinex/parse.go +++ b/providers/websockets/bitfinex/parse.go @@ -3,6 +3,7 @@ package bitfinex import ( "encoding/json" "fmt" + "math/big" "time" providertypes "github.com/skip-mev/slinky/providers/types" @@ -10,7 +11,6 @@ import ( "go.uber.org/zap" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" "github.com/skip-mev/slinky/providers/base/websocket/handlers" ) @@ -119,8 +119,8 @@ func (h *WebSocketHandler) handleStream( } lastPrice := dataArr[6] - // Convert the price to a big int. - price := math.Float64ToBigInt(lastPrice.(float64), ticker.Decimals) + // Convert the price to a big Float. + price := big.NewFloat(lastPrice.(float64)) resolved[ticker] = types.NewPriceResult(price, time.Now().UTC()) return types.NewPriceResponse(resolved, unResolved), nil @@ -128,7 +128,7 @@ func (h *WebSocketHandler) handleStream( // updateChannelMap updates the internal map for the given channelID and ticker. func (h *WebSocketHandler) updateChannelMap(channelID int, offChainTicker string) error { - ticker, ok := h.market.OffChainMap[offChainTicker] + ticker, ok := h.cache.FromOffChainTicker(offChainTicker) if !ok { return fmt.Errorf("unknown ticker %s", offChainTicker) } diff --git a/providers/websockets/bitfinex/utils.go b/providers/websockets/bitfinex/utils.go index 79e17bcc9..5b13ee23b 100644 --- a/providers/websockets/bitfinex/utils.go +++ b/providers/websockets/bitfinex/utils.go @@ -36,25 +36,20 @@ var ( } // DefaultMarketConfig is the default market configuration for BitFinex. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "BTCUSD", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "TIAUSD", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETHBTC", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ETHUSD", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOLUSD", }, } diff --git a/providers/websockets/bitfinex/ws_data_handler.go b/providers/websockets/bitfinex/ws_data_handler.go index 03471f98b..606726321 100644 --- a/providers/websockets/bitfinex/ws_data_handler.go +++ b/providers/websockets/bitfinex/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,28 +18,19 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the BitFinex API. - market types.ProviderMarketMap // ws is the config for the BitFinex websocket. ws config.WebSocketConfig // channelMap maps a given channel_id to the currency pair its subscription represents. - channelMap map[int]mmtypes.Ticker + channelMap map[int]types.ProviderTicker + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new BitFinex PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -55,9 +45,9 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, - channelMap: make(map[int]mmtypes.Ticker), + channelMap: make(map[int]types.ProviderTicker), + cache: types.NewProviderTickers(), }, nil } @@ -130,7 +120,7 @@ func (h *WebSocketHandler) HandleMessage( // Only the tickers that are specified in the config are subscribed to. The only channel that is // subscribed to is the index tickers channel - which supports spot markets. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { if len(tickers) == 0 { return nil, nil @@ -138,18 +128,13 @@ func (h *WebSocketHandler) CreateMessages( msgs := make([]handlers.WebsocketEncodedMessage, len(tickers)) for i, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker %s not in config", ticker.String()) - } - - msg, err := NewSubscribeMessage(market.OffChainTicker) + msg, err := NewSubscribeMessage(ticker.GetOffChainTicker()) if err != nil { return nil, fmt.Errorf("error marshalling subscription message: %w", err) } msgs[i] = msg - + h.cache.Add(ticker) } return msgs, nil @@ -164,8 +149,8 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, - channelMap: make(map[int]mmtypes.Ticker), + channelMap: make(map[int]types.ProviderTicker), + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/bitfinex/ws_data_handler_test.go b/providers/websockets/bitfinex/ws_data_handler_test.go index bd66cdc1b..b69d49bba 100644 --- a/providers/websockets/bitfinex/ws_data_handler_test.go +++ b/providers/websockets/bitfinex/ws_data_handler_test.go @@ -12,11 +12,11 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/bitfinex" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusd = bitfinex.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = bitfinex.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) channelBTC = 111 logger = zap.NewExample() ) @@ -25,7 +25,7 @@ func rawStringToBz(raw string) []byte { return []byte(raw) } -func TestHandlerMessage(t *testing.T) { +func TestHandleMessage(t *testing.T) { testCases := []struct { name string preRun func() []byte @@ -81,8 +81,8 @@ func TestHandlerMessage(t *testing.T) { }, resp: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(100000000), + btcusd: { + Value: big.NewFloat(1.0), }, }, types.UnResolvedPrices{}, @@ -152,10 +152,11 @@ func TestHandlerMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bitfinex.Name, bitfinex.DefaultMarketConfig) + wsHandler, err := bitfinex.NewWebSocketDataHandler(logger, bitfinex.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := bitfinex.NewWebSocketDataHandler(logger, marketConfig, bitfinex.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusd, ethusd}) require.NoError(t, err) if tc.preRun() != nil { @@ -176,7 +177,7 @@ func TestHandlerMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -187,16 +188,16 @@ func TestHandlerMessage(t *testing.T) { } } -func TestCreateMessage(t *testing.T) { +func TestCreateMessages(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -204,8 +205,8 @@ func TestCreateMessage(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, expected: func() []handlers.WebsocketEncodedMessage { msg := bitfinex.SubscribeMessage{ @@ -223,9 +224,9 @@ func TestCreateMessage(t *testing.T) { }, { name: "two currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, expected: func() []handlers.WebsocketEncodedMessage { msg := bitfinex.SubscribeMessage{ @@ -248,24 +249,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one currency pair not in config", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bitfinex.Name, bitfinex.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := bitfinex.NewWebSocketDataHandler(logger, marketConfig, bitfinex.DefaultWebSocketConfig) + wsHandler, err := bitfinex.NewWebSocketDataHandler(logger, bitfinex.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) diff --git a/providers/websockets/bitstamp/parse.go b/providers/websockets/bitstamp/parse.go index 1b789d58d..2e011ace2 100644 --- a/providers/websockets/bitstamp/parse.go +++ b/providers/websockets/bitstamp/parse.go @@ -35,14 +35,14 @@ func (h *WebSocketHandler) parseTickerMessage( // Get the ticker from the message and market. offChainTicker := tickerSplit[TickerCurrencyPairIndex] - ticker, ok := h.market.OffChainMap[offChainTicker] + ticker, ok := h.cache.FromOffChainTicker(offChainTicker) if !ok { return types.NewPriceResponse(resolved, unResolved), fmt.Errorf("received unsupported ticker %s", ticker) } // Get the price from the message. - price, err := math.Float64StringToBigInt(msg.Data.PriceStr, ticker.Decimals) + price, err := math.Float64StringToBigFloat(msg.Data.PriceStr) if err != nil { unResolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToParsePrice), diff --git a/providers/websockets/bitstamp/utils.go b/providers/websockets/bitstamp/utils.go index ee2ce2f1d..cd8f3e651 100644 --- a/providers/websockets/bitstamp/utils.go +++ b/providers/websockets/bitstamp/utils.go @@ -39,41 +39,32 @@ var ( } // DefaultMarketConfig returns the default market config for bitstamp. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.AVAX_USD: { - Name: Name, OffChainTicker: "avaxusd", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "btcusd", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "btcusdc", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "btcusdt", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ethbtc", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ethusd", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "solusd", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "usdcusdt", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "usdtusd", }, } diff --git a/providers/websockets/bitstamp/ws_data_handler.go b/providers/websockets/bitstamp/ws_data_handler.go index 328ffaf56..3c11d435a 100644 --- a/providers/websockets/bitstamp/ws_data_handler.go +++ b/providers/websockets/bitstamp/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,26 +18,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the Bitstamp API. - market types.ProviderMarketMap // ws is the config for the Bitstamp websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Bitstamp PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -53,8 +43,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -120,17 +110,13 @@ func (h *WebSocketHandler) HandleMessage( // CreateMessages creates the messages to send to the Bitstamp websocket API. The // messages are used to subscribe to the live trades channel for the specified tickers. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - instruments = append(instruments, fmt.Sprintf("%s%s", TickerChannel, market.OffChainTicker)) + instruments = append(instruments, fmt.Sprintf("%s%s", TickerChannel, ticker.GetOffChainTicker())) + h.cache.Add(ticker) } return NewSubscriptionRequestMessages(instruments) @@ -146,7 +132,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/bitstamp/ws_data_handler_test.go b/providers/websockets/bitstamp/ws_data_handler_test.go index 76f7fb343..11f165439 100644 --- a/providers/websockets/bitstamp/ws_data_handler_test.go +++ b/providers/websockets/bitstamp/ws_data_handler_test.go @@ -14,11 +14,11 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/bitstamp" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusd = bitstamp.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = bitstamp.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) logger = zap.NewExample() ) @@ -79,8 +79,8 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(10000000000000), + btcusd: { + Value: big.NewFloat(100000.00), }, }, }, @@ -129,7 +129,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("error"), providertypes.ErrorWebSocketGeneral), }, }, @@ -143,10 +143,11 @@ func TestHandleMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bitstamp.Name, bitstamp.DefaultMarketConfig) + wsHandler, err := bitstamp.NewWebSocketDataHandler(logger, bitstamp.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := bitstamp.NewWebSocketDataHandler(logger, marketConfig, bitstamp.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusd, ethusd}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -168,7 +169,7 @@ func TestHandleMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -182,13 +183,13 @@ func TestHandleMessage(t *testing.T) { func TestCreateMessages(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -196,8 +197,8 @@ func TestCreateMessages(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, expected: func() []handlers.WebsocketEncodedMessage { return []handlers.WebsocketEncodedMessage{ @@ -208,9 +209,9 @@ func TestCreateMessages(t *testing.T) { }, { name: "two currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, expected: func() []handlers.WebsocketEncodedMessage { return []handlers.WebsocketEncodedMessage{ @@ -220,24 +221,11 @@ func TestCreateMessages(t *testing.T) { }, expectedErr: false, }, - { - name: "unsupported currency pair", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bitstamp.Name, bitstamp.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := bitstamp.NewWebSocketDataHandler(logger, marketConfig, bitstamp.DefaultWebSocketConfig) + wsHandler, err := bitstamp.NewWebSocketDataHandler(logger, bitstamp.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) @@ -252,10 +240,7 @@ func TestCreateMessages(t *testing.T) { } func TestHeartBeat(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bitstamp.Name, bitstamp.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := bitstamp.NewWebSocketDataHandler(logger, marketConfig, bitstamp.DefaultWebSocketConfig) + wsHandler, err := bitstamp.NewWebSocketDataHandler(logger, bitstamp.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.HeartBeatMessages() diff --git a/providers/websockets/bybit/parse.go b/providers/websockets/bybit/parse.go index 6bd6582b8..f23b69a3d 100644 --- a/providers/websockets/bybit/parse.go +++ b/providers/websockets/bybit/parse.go @@ -51,15 +51,15 @@ func (h *WebSocketHandler) parseTickerUpdate( // Iterate through all the tickers and add them to the response. data := resp.Data - ticker, ok := h.market.OffChainMap[data.Symbol] + ticker, ok := h.cache.FromOffChainTicker(data.Symbol) if !ok { return types.NewPriceResponse(resolved, unresolved), fmt.Errorf("unknown ticker %s", data.Symbol) } - // Convert the price to a big.Int. - price, err := math.Float64StringToBigInt(data.LastPrice, ticker.Decimals) + // Convert the price to a big.Float. + price, err := math.Float64StringToBigFloat(data.LastPrice) if err != nil { - wErr := fmt.Errorf("failed to convert price to big.Int: %w", err) + wErr := fmt.Errorf("failed to convert price to big.Float: %w", err) unresolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(wErr, providertypes.ErrorFailedToParsePrice), } diff --git a/providers/websockets/bybit/utils.go b/providers/websockets/bybit/utils.go index 4d850731e..9658e0b13 100644 --- a/providers/websockets/bybit/utils.go +++ b/providers/websockets/bybit/utils.go @@ -46,121 +46,92 @@ var ( } // DefaultMarketConfig is the default market configuration for ByBit. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APTUSDT", }, constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARBUSDT", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOMUSDT", }, constants.AVAX_USDC: { - Name: Name, OffChainTicker: "AVAXUSDC", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAXUSDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCHUSDT", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTCUSDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTCUSDT", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADAUSDT", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINKUSDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGEUSDT", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDXUSDT", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETHUSDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETHUSDT", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTCUSDT", }, constants.PEPE_USDT: { - Name: Name, OffChainTicker: "PEPEUSDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOTUSDT", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATICUSDT", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "SEIUSDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIBUSDT", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOLUSDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOLUSDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUIUSDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRXUSDT", }, constants.UNISWAP_USDT: { - Name: Name, OffChainTicker: "UNIUSDT", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLDUSDT", }, constants.STELLAR_USDT: { - Name: Name, OffChainTicker: "XLMUSDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRPUSDT", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDCUSDT", }, } diff --git a/providers/websockets/bybit/ws_data_hander_test.go b/providers/websockets/bybit/ws_data_hander_test.go index 9550233d4..bbf25d73d 100644 --- a/providers/websockets/bybit/ws_data_hander_test.go +++ b/providers/websockets/bybit/ws_data_hander_test.go @@ -12,12 +12,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/bybit" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusdt = bybit.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = bybit.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + logger = zap.NewExample() ) func TestHandlerMessage(t *testing.T) { @@ -71,8 +71,8 @@ func TestHandlerMessage(t *testing.T) { }, resp: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(100000000), + btcusdt: { + Value: big.NewFloat(1.0), }, }, types.UnResolvedPrices{}, @@ -159,10 +159,11 @@ func TestHandlerMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bybit.Name, bybit.DefaultMarketConfig) + wsHandler, err := bybit.NewWebSocketDataHandler(logger, bybit.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := bybit.NewWebSocketDataHandler(logger, marketConfig, bybit.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusdt, ethusdt}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -178,7 +179,7 @@ func TestHandlerMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -192,13 +193,13 @@ func TestHandlerMessage(t *testing.T) { func TestCreateMessage(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []byte expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []byte { return nil }, @@ -206,8 +207,8 @@ func TestCreateMessage(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, expected: func() []byte { msg := bybit.SubscriptionRequest{ @@ -226,9 +227,9 @@ func TestCreateMessage(t *testing.T) { }, { name: "two currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, expected: func() []byte { msg := bybit.SubscriptionRequest{ @@ -245,24 +246,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one currency pair not in config", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []byte { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(bybit.Name, bybit.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := bybit.NewWebSocketDataHandler(logger, marketConfig, bybit.DefaultWebSocketConfig) + wsHandler, err := bybit.NewWebSocketDataHandler(logger, bybit.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) diff --git a/providers/websockets/bybit/ws_data_handler.go b/providers/websockets/bybit/ws_data_handler.go index bd4ca9ef9..48ef5a8db 100644 --- a/providers/websockets/bybit/ws_data_handler.go +++ b/providers/websockets/bybit/ws_data_handler.go @@ -10,7 +10,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -20,26 +19,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the ByBit API. - market types.ProviderMarketMap // ws is the config for the ByBit websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new ByBit PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -54,8 +44,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -124,17 +114,13 @@ func (h *WebSocketHandler) HandleMessage( // Only the tickers that are specified in the config are subscribed to. The only channel that is // subscribed to is the index tickers channel - which supports spot markets. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { pairs := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - pairs = append(pairs, string(TickerChannel)+"."+market.OffChainTicker) + pairs = append(pairs, string(TickerChannel)+"."+ticker.GetOffChainTicker()) + h.cache.Add(ticker) } return NewSubscriptionRequestMessage(pairs) @@ -159,7 +145,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/coinbase/parse.go b/providers/websockets/coinbase/parse.go index d2f453ba7..b7030ae55 100644 --- a/providers/websockets/coinbase/parse.go +++ b/providers/websockets/coinbase/parse.go @@ -24,7 +24,7 @@ func (h *WebSocketHandler) parseTickerResponseMessage( ) // Determine if the ticker is valid. - ticker, ok := h.market.OffChainMap[msg.Ticker] + ticker, ok := h.cache.FromOffChainTicker(msg.Ticker) if !ok { return types.NewPriceResponse(resolved, unResolved), fmt.Errorf("got response for an unsupported market %s", msg.Ticker) @@ -50,8 +50,8 @@ func (h *WebSocketHandler) parseTickerResponseMessage( return types.NewPriceResponse(resolved, unResolved), err } - // Convert the price to a big int. - price, err := math.Float64StringToBigInt(msg.Price, ticker.Decimals) + // Convert the price to a big Float. + price, err := math.Float64StringToBigFloat(msg.Price) if err != nil { unResolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToParsePrice), diff --git a/providers/websockets/coinbase/utils.go b/providers/websockets/coinbase/utils.go index 7eb1fc6b6..387253dfb 100644 --- a/providers/websockets/coinbase/utils.go +++ b/providers/websockets/coinbase/utils.go @@ -55,189 +55,143 @@ var ( } // DefaultMarketConfig is the default market configuration for Coinbase. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USD: { - Name: Name, OffChainTicker: "APE-USD", }, constants.APE_USDT: { - Name: Name, OffChainTicker: "APE-USDT", }, constants.APTOS_USD: { - Name: Name, OffChainTicker: "APT-USD", }, constants.ARBITRUM_USD: { - Name: Name, OffChainTicker: "ARB-USD", }, constants.ATOM_USD: { - Name: Name, OffChainTicker: "ATOM-USD", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOM-USDT", }, constants.AVAX_USD: { - Name: Name, OffChainTicker: "AVAX-USD", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX-USDT", }, constants.BCH_USD: { - Name: Name, OffChainTicker: "BCH-USD", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "BTC-USD", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC-USDT", }, constants.BLUR_USD: { - Name: Name, OffChainTicker: "BLUR-USD", }, constants.CARDANO_USD: { - Name: Name, OffChainTicker: "ADA-USD", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "TIA-USD", }, constants.CELESTIA_USDC: { - Name: Name, OffChainTicker: "TIA-USDC", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "TIA-USDT", }, constants.CHAINLINK_USD: { - Name: Name, OffChainTicker: "LINK-USD", }, constants.COMPOUND_USD: { - Name: Name, OffChainTicker: "COMP-USD", }, constants.CURVE_USD: { - Name: Name, OffChainTicker: "CRV-USD", }, constants.DOGE_USD: { - Name: Name, OffChainTicker: "DOGE-USD", }, constants.ETC_USD: { - Name: Name, OffChainTicker: "ETC-USD", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH-BTC", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ETH-USD", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH-USDT", }, constants.FILECOIN_USD: { - Name: Name, OffChainTicker: "FIL-USD", }, constants.LIDO_USD: { - Name: Name, OffChainTicker: "LDO-USD", }, constants.LITECOIN_USD: { - Name: Name, OffChainTicker: "LTC-USD", }, constants.MAKER_USD: { - Name: Name, OffChainTicker: "MKR-USD", }, constants.NEAR_USD: { - Name: Name, OffChainTicker: "NEAR-USD", }, constants.OPTIMISM_USD: { - Name: Name, OffChainTicker: "OP-USD", }, constants.OSMOSIS_USD: { - Name: Name, OffChainTicker: "OSMO-USD", }, constants.OSMOSIS_USDC: { - Name: Name, OffChainTicker: "OSMO-USDC", }, constants.OSMOSIS_USDT: { - Name: Name, OffChainTicker: "OSMO-USDT", }, constants.POLKADOT_USD: { - Name: Name, OffChainTicker: "DOT-USD", }, constants.POLYGON_USD: { - Name: Name, OffChainTicker: "MATIC-USD", }, constants.RIPPLE_USD: { - Name: Name, OffChainTicker: "XRP-USD", }, constants.SEI_USD: { - Name: Name, OffChainTicker: "SEI-USD", }, constants.SHIBA_USD: { - Name: Name, OffChainTicker: "SHIB-USD", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOL-USD", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOL-USDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL-USDT", }, constants.STELLAR_USD: { - Name: Name, OffChainTicker: "XLM-USD", }, constants.SUI_USD: { - Name: Name, OffChainTicker: "SUI-USD", }, constants.UNISWAP_USD: { - Name: Name, OffChainTicker: "UNI-USD", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDC-USDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDT-USD", }, } diff --git a/providers/websockets/coinbase/ws_data_handler.go b/providers/websockets/coinbase/ws_data_handler.go index a4858cba3..3d8903023 100644 --- a/providers/websockets/coinbase/ws_data_handler.go +++ b/providers/websockets/coinbase/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,28 +18,19 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the Coinbase API. - market types.ProviderMarketMap // ws is the config for the Coinbase websocket. ws config.WebSocketConfig // Sequence is the current sequence number for the Coinbase websocket API per currency pair. - sequence map[mmtypes.Ticker]int64 + sequence map[types.ProviderTicker]int64 + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Coinbase PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -55,9 +45,9 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, - sequence: make(map[mmtypes.Ticker]int64), + sequence: make(map[types.ProviderTicker]int64), + cache: types.NewProviderTickers(), }, nil } @@ -118,17 +108,13 @@ func (h *WebSocketHandler) HandleMessage( // subscribe to the given tickers. This is called when the connection to the data provider is // first established. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - instruments = append(instruments, market.OffChainTicker) + instruments = append(instruments, ticker.GetOffChainTicker()) + h.cache.Add(ticker) } return NewSubscribeRequestMessage(instruments) @@ -143,8 +129,8 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, - sequence: make(map[mmtypes.Ticker]int64), + sequence: make(map[types.ProviderTicker]int64), + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/coinbase/ws_data_handler_test.go b/providers/websockets/coinbase/ws_data_handler_test.go index 2db0608b3..1f2188e34 100644 --- a/providers/websockets/coinbase/ws_data_handler_test.go +++ b/providers/websockets/coinbase/ws_data_handler_test.go @@ -16,12 +16,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/coinbase" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( + btcusd = coinbase.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = coinbase.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) ) func TestHandleMessage(t *testing.T) { @@ -58,8 +58,8 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(1000000000000), + btcusd: { + Value: big.NewFloat(10000.00), }, }, }, @@ -106,7 +106,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("failed to convert price to big int"), providertypes.ErrorUnknown), }, }, @@ -133,7 +133,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USD: providertypes.UnresolvedResult{ + btcusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("received out of order ticker response message"), providertypes.ErrorUnknown), }, }, @@ -171,10 +171,11 @@ func TestHandleMessage(t *testing.T) { }, } - marketConfig, err := types.NewProviderMarketMap(coinbase.Name, coinbase.DefaultMarketConfig) + wsHandler, err := coinbase.NewWebSocketDataHandler(logger, coinbase.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := coinbase.NewWebSocketDataHandler(logger, marketConfig, coinbase.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusd, ethusd}) require.NoError(t, err) for _, tc := range testCases { @@ -198,7 +199,7 @@ func TestHandleMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -212,13 +213,13 @@ func TestHandleMessage(t *testing.T) { func TestCreateMessages(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs to subscribe to", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -226,8 +227,8 @@ func TestCreateMessages(t *testing.T) { }, { name: "one currency pair to subscribe to", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, expected: func() []handlers.WebsocketEncodedMessage { msg := coinbase.SubscribeRequestMessage{ @@ -249,9 +250,9 @@ func TestCreateMessages(t *testing.T) { }, { name: "multiple currency pairs to subscribe to", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, expected: func() []handlers.WebsocketEncodedMessage { msg := coinbase.SubscribeRequestMessage{ @@ -272,26 +273,11 @@ func TestCreateMessages(t *testing.T) { }, expectedErr: false, }, - { - name: "multiple currency pairs to subscribe to with one not supported", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(coinbase.Name, coinbase.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := coinbase.NewWebSocketDataHandler(logger, marketConfig, coinbase.DefaultWebSocketConfig) + wsHandler, err := coinbase.NewWebSocketDataHandler(logger, coinbase.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) diff --git a/providers/websockets/cryptodotcom/parse.go b/providers/websockets/cryptodotcom/parse.go index 26e7ccc69..66ff41f58 100644 --- a/providers/websockets/cryptodotcom/parse.go +++ b/providers/websockets/cryptodotcom/parse.go @@ -33,16 +33,15 @@ func (h *WebSocketHandler) parseInstrumentMessage( for _, instrument := range instruments { // If we don't have a mapping for the instrument, return an error. This is likely a configuration // error. - ticker, ok := h.market.OffChainMap[instrument.Name] + ticker, ok := h.cache.FromOffChainTicker(instrument.Name) if !ok { h.logger.Error("failed to find currency pair for instrument", zap.String("instrument", instrument.Name)) continue } // Attempt to parse the price. - if price, err := math.Float64StringToBigInt(instrument.LatestTradePrice, ticker.Decimals); err != nil { - wErr := fmt.Errorf("failed to parse price %s:"+ - " %w", instrument.LatestTradePrice, err) + if price, err := math.Float64StringToBigFloat(instrument.LatestTradePrice); err != nil { + wErr := fmt.Errorf("failed to parse price %s:"+" %w", instrument.LatestTradePrice, err) unresolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(wErr, providertypes.ErrorFailedToParsePrice), } diff --git a/providers/websockets/cryptodotcom/utils.go b/providers/websockets/cryptodotcom/utils.go index 57a52036f..c7034f294 100644 --- a/providers/websockets/cryptodotcom/utils.go +++ b/providers/websockets/cryptodotcom/utils.go @@ -42,73 +42,56 @@ var ( } // DefaultMarketConfig is the default market configuration for Crypto.com. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.ATOM_USD: { - Name: Name, OffChainTicker: "ATOMUSD-PERP", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOM_USDT", }, constants.AVAX_USD: { - Name: Name, OffChainTicker: "AVAXUSD-PERP", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX_USDT", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "BTCUSD-PERP", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC_USDT", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "TIAUSD-PERP", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "TIA_USDT", }, constants.DYDX_USD: { - Name: Name, OffChainTicker: "DYDXUSD-PERP", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDX_USDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH_BTC", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ETHUSD-PERP", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH_USDT", }, constants.OSMOSIS_USD: { - Name: Name, OffChainTicker: "OSMO_USD", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOLUSD-PERP", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL_USDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDT_USD", }, } diff --git a/providers/websockets/cryptodotcom/ws_data_handler.go b/providers/websockets/cryptodotcom/ws_data_handler.go index 2dfb71211..7945c4a99 100644 --- a/providers/websockets/cryptodotcom/ws_data_handler.go +++ b/providers/websockets/cryptodotcom/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,26 +18,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the Crypto.com API. - market types.ProviderMarketMap // ws is the config for the Crypto.com websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Crypto.com PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -53,8 +43,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -112,17 +102,13 @@ func (h *WebSocketHandler) HandleMessage( // subscribe to the given tickers. This is called when the connection to the data provider // is first established. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - instruments = append(instruments, fmt.Sprintf(TickerChannel, market.OffChainTicker)) + instruments = append(instruments, fmt.Sprintf(TickerChannel, ticker.GetOffChainTicker())) + h.cache.Add(ticker) } return NewInstrumentMessage(instruments) @@ -137,7 +123,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/cryptodotcom/ws_data_handler_test.go b/providers/websockets/cryptodotcom/ws_data_handler_test.go index 5d19560eb..4e56927d0 100644 --- a/providers/websockets/cryptodotcom/ws_data_handler_test.go +++ b/providers/websockets/cryptodotcom/ws_data_handler_test.go @@ -16,12 +16,13 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/cryptodotcom" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( + btcusd = cryptodotcom.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = cryptodotcom.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) + solusd = cryptodotcom.DefaultMarketConfig.MustGetProviderTicker(constants.SOLANA_USD) logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) ) func TestHandleMessage(t *testing.T) { @@ -137,7 +138,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USD: types.NewPriceResult(big.NewInt(4206900000000), time.Now()), + btcusd: types.NewPriceResult(big.NewFloat(42069.00), time.Now()), }, UnResolved: types.UnResolvedPrices{}, }, @@ -202,9 +203,9 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USD: types.NewPriceResult(big.NewInt(4206900000000), time.Now()), - constants.ETHEREUM_USD: types.NewPriceResult(big.NewInt(200000000000), time.Now()), - constants.SOLANA_USD: types.NewPriceResult(big.NewInt(100000000000), time.Now()), + btcusd: types.NewPriceResult(big.NewFloat(42069.00), time.Now()), + ethusd: types.NewPriceResult(big.NewFloat(2000.00), time.Now()), + solusd: types.NewPriceResult(big.NewFloat(1000.00), time.Now()), }, UnResolved: types.UnResolvedPrices{}, }, @@ -239,10 +240,10 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USD: types.NewPriceResult(big.NewInt(4206900000000), time.Now()), + btcusd: types.NewPriceResult(big.NewFloat(42069.00), time.Now()), }, UnResolved: types.UnResolvedPrices{ - constants.SOLANA_USD: providertypes.UnresolvedResult{ + solusd: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("failed to parse price $42,069.00: invalid syntax"), providertypes.ErrorWebSocketGeneral), }, }, @@ -256,10 +257,11 @@ func TestHandleMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(cryptodotcom.Name, cryptodotcom.DefaultMarketConfig) + wsHandler, err := cryptodotcom.NewWebSocketDataHandler(logger, cryptodotcom.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := cryptodotcom.NewWebSocketDataHandler(logger, marketConfig, cryptodotcom.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusd, ethusd, solusd}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -275,7 +277,7 @@ func TestHandleMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -289,20 +291,20 @@ func TestHandleMessage(t *testing.T) { func TestCreateMessage(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker msg cryptodotcom.InstrumentRequestMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, msg: cryptodotcom.InstrumentRequestMessage{}, expectedErr: true, }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, msg: cryptodotcom.InstrumentRequestMessage{ Method: "subscribe", @@ -314,10 +316,10 @@ func TestCreateMessage(t *testing.T) { }, { name: "multiple currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, - constants.SOLANA_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, + solusd, }, msg: cryptodotcom.InstrumentRequestMessage{ Method: "subscribe", @@ -331,28 +333,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one found and one not found", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - mogusd, - }, - msg: cryptodotcom.InstrumentRequestMessage{ - Method: "subscribe", - Params: cryptodotcom.InstrumentParams{ - Channels: []string{"ticker.BTCUSD-PERP"}, - }, - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(cryptodotcom.Name, cryptodotcom.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := cryptodotcom.NewWebSocketDataHandler(logger, marketConfig, cryptodotcom.DefaultWebSocketConfig) + wsHandler, err := cryptodotcom.NewWebSocketDataHandler(logger, cryptodotcom.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) diff --git a/providers/websockets/gate/parse.go b/providers/websockets/gate/parse.go index 3fb55db52..7a27ecb51 100644 --- a/providers/websockets/gate/parse.go +++ b/providers/websockets/gate/parse.go @@ -43,7 +43,7 @@ func (h *WebSocketHandler) parseTickerStream( } // Get the ticker from the off-chain representation. - ticker, ok := h.market.OffChainMap[stream.Result.CurrencyPair] + ticker, ok := h.cache.FromOffChainTicker(stream.Result.CurrencyPair) if !ok { return types.NewPriceResponse(resolved, unresolved), fmt.Errorf("no currency pair found for symbol %s", stream.Result.CurrencyPair) @@ -51,7 +51,7 @@ func (h *WebSocketHandler) parseTickerStream( // Parse the price update. priceStr := stream.Result.Last - price, err := math.Float64StringToBigInt(priceStr, ticker.Decimals) + price, err := math.Float64StringToBigFloat(priceStr) if err != nil { wErr := fmt.Errorf("failed to parse price %s: %w", priceStr, err) unresolved[ticker] = providertypes.UnresolvedResult{ diff --git a/providers/websockets/gate/utils.go b/providers/websockets/gate/utils.go index 6731f5229..ddc7d21a3 100644 --- a/providers/websockets/gate/utils.go +++ b/providers/websockets/gate/utils.go @@ -35,137 +35,104 @@ var ( } // DefaultMarketConfig is the default market configuration for Gate.io. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARB_USDT", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOM_USDT", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX_USDT", }, constants.APE_USDT: { - Name: Name, OffChainTicker: "APE_USDT", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APT_USDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCH_USDT", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC_USDT", }, constants.BLUR_USDT: { - Name: Name, OffChainTicker: "BLUR_USDT", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADA_USDT", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "TIA_USDT", }, constants.COMPOUND_USDT: { - Name: Name, OffChainTicker: "COMP_USDT", }, constants.CURVE_USDT: { - Name: Name, OffChainTicker: "CRV_USDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGE_USDT", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDX_USDT", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "ETC_USDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH_BTC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH_USDT", }, constants.FILECOIN_USDT: { - Name: Name, OffChainTicker: "FIL_USDT", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "NEAR_USDT", }, constants.OPTIMISM_USDT: { - Name: Name, OffChainTicker: "OP_USDT", }, constants.PEPE_USDT: { - Name: Name, OffChainTicker: "PEPE_USDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOT_USDT", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATIC_USDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRP_USDT", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "SEI_USDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIB_USDT", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOL_USDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL_USDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUI_USDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRX_USDT", }, constants.UNISWAP_USDT: { - Name: Name, OffChainTicker: "UNI_USDT", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDC_USDT", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLD_USDT", }, } diff --git a/providers/websockets/gate/ws_data_handler.go b/providers/websockets/gate/ws_data_handler.go index 6016e308c..fe646e045 100644 --- a/providers/websockets/gate/ws_data_handler.go +++ b/providers/websockets/gate/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,26 +18,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the Gate.io API. - market types.ProviderMarketMap // ws is the config for the Gate.io websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Gate.io PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -53,8 +43,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -109,18 +99,13 @@ func (h *WebSocketHandler) HandleMessage( // Only the tickers that are specified in the config are subscribed to. The only channel that is // subscribed to is the tickers channel - which supports spot markets. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - h.logger.Debug("market not found for currency pair", zap.String("ticker", ticker.String())) - continue - } - - instruments = append(instruments, market.OffChainTicker) + instruments = append(instruments, ticker.GetOffChainTicker()) + h.cache.Add(ticker) } return NewSubscribeRequest(instruments) @@ -135,7 +120,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/gate/ws_data_handler_test.go b/providers/websockets/gate/ws_data_handler_test.go index 03c7da1f7..c883b1d38 100644 --- a/providers/websockets/gate/ws_data_handler_test.go +++ b/providers/websockets/gate/ws_data_handler_test.go @@ -13,12 +13,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/gate" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusdt = gate.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = gate.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + logger = zap.NewExample() ) func TestHandlerMessage(t *testing.T) { @@ -100,8 +100,8 @@ func TestHandlerMessage(t *testing.T) { }, resp: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(100000000), + btcusdt: { + Value: big.NewFloat(1.00), }, }, types.UnResolvedPrices{}, @@ -198,10 +198,11 @@ func TestHandlerMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(gate.Name, gate.DefaultMarketConfig) + wsHandler, err := gate.NewWebSocketDataHandler(logger, gate.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := gate.NewWebSocketDataHandler(logger, marketConfig, gate.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusdt, ethusdt}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -217,7 +218,7 @@ func TestHandlerMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -231,13 +232,13 @@ func TestHandlerMessage(t *testing.T) { func TestCreateMessage(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -245,8 +246,8 @@ func TestCreateMessage(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := gate.SubscribeRequest{ @@ -268,9 +269,9 @@ func TestCreateMessage(t *testing.T) { }, { name: "two currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := gate.SubscribeRequest{ @@ -290,24 +291,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one currency pair not in config", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(gate.Name, gate.DefaultMarketConfig) - require.NoError(t, err) - - handler, err := gate.NewWebSocketDataHandler(logger, marketConfig, gate.DefaultWebSocketConfig) + handler, err := gate.NewWebSocketDataHandler(logger, gate.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := handler.CreateMessages(tc.cps) diff --git a/providers/websockets/huobi/parse.go b/providers/websockets/huobi/parse.go index 98947d6f1..ea3219aca 100644 --- a/providers/websockets/huobi/parse.go +++ b/providers/websockets/huobi/parse.go @@ -2,12 +2,12 @@ package huobi import ( "fmt" + "math/big" "time" "go.uber.org/zap" "github.com/skip-mev/slinky/oracle/types" - "github.com/skip-mev/slinky/pkg/math" "github.com/skip-mev/slinky/providers/base/websocket/handlers" ) @@ -41,13 +41,13 @@ func (h *WebSocketHandler) parseTickerStream(stream TickerStream) (types.PriceRe fmt.Errorf("incorrectly formatted stream: %v", stream) } - ticker, ok := h.market.OffChainMap[offChainTicker] + ticker, ok := h.cache.FromOffChainTicker(offChainTicker) if !ok { return types.NewPriceResponse(resolved, unresolved), fmt.Errorf("received stream for unknown channel %s", stream.Channel) } - price := math.Float64ToBigInt(stream.Tick.LastPrice, ticker.Decimals) + price := big.NewFloat(stream.Tick.LastPrice) resolved[ticker] = types.NewPriceResult(price, time.Now().UTC()) return types.NewPriceResponse(resolved, unresolved), nil diff --git a/providers/websockets/huobi/utils.go b/providers/websockets/huobi/utils.go index 9e9055802..cb34890b1 100644 --- a/providers/websockets/huobi/utils.go +++ b/providers/websockets/huobi/utils.go @@ -40,109 +40,83 @@ var ( } // DefaultMarketConfig is the default market configuration for the Huobi Websocket. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "arbusdt", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "atomusdt", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "avaxusdt", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "aptusdt", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "bchusdt", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "btcusdc", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "btcusdt", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "adausdt", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "tiausdt", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "dogeusdt", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "dydxusdt", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "etcusdt", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ethbtc", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ethusdc", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ethusdt", }, constants.FILECOIN_USDT: { - Name: Name, OffChainTicker: "filusdt", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "ltcusdt", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "nearusdt", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "maticusdt", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "xrpusdt", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "seiusdt", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "solusdt", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "suiusdt", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "trxusdt", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "usdcusdt", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "wldusdt", }, } diff --git a/providers/websockets/huobi/ws_data_handler.go b/providers/websockets/huobi/ws_data_handler.go index 69d224243..68b96a327 100644 --- a/providers/websockets/huobi/ws_data_handler.go +++ b/providers/websockets/huobi/ws_data_handler.go @@ -13,7 +13,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -23,26 +22,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the Huobi API. - market types.ProviderMarketMap // ws is the config for the Huobi websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Huobi PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -57,8 +47,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -133,7 +123,7 @@ func (h *WebSocketHandler) HandleMessage( // Only the tickers that are specified in the config are subscribed to. The only channel that is // subscribed to is the index tickers channel - which supports spot markets. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { if len(tickers) == 0 { return nil, fmt.Errorf("no tickers to subscribe to") @@ -141,18 +131,13 @@ func (h *WebSocketHandler) CreateMessages( msgs := make([]handlers.WebsocketEncodedMessage, len(tickers)) for i, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - msg, err := NewSubscriptionRequest(market.OffChainTicker) + msg, err := NewSubscriptionRequest(ticker.GetOffChainTicker()) if err != nil { return nil, fmt.Errorf("error marshalling subscription message: %w", err) } msgs[i] = msg - + h.cache.Add(ticker) } return msgs, nil @@ -167,7 +152,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/huobi/ws_data_handler_test.go b/providers/websockets/huobi/ws_data_handler_test.go index 26a628de0..8a3ffc67a 100644 --- a/providers/websockets/huobi/ws_data_handler_test.go +++ b/providers/websockets/huobi/ws_data_handler_test.go @@ -15,12 +15,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/huobi" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusdt = huobi.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = huobi.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + logger = zap.NewExample() ) func TestHandlerMessage(t *testing.T) { @@ -87,8 +87,8 @@ func TestHandlerMessage(t *testing.T) { }, resp: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(100000000), + btcusdt: { + Value: big.NewFloat(1), }, }, types.UnResolvedPrices{}, @@ -243,10 +243,11 @@ func TestHandlerMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(huobi.Name, huobi.DefaultMarketConfig) + wsHandler, err := huobi.NewWebSocketDataHandler(logger, huobi.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := huobi.NewWebSocketDataHandler(logger, marketConfig, huobi.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusdt, ethusdt}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -276,13 +277,13 @@ func TestHandlerMessage(t *testing.T) { func TestCreateMessage(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -290,8 +291,8 @@ func TestCreateMessage(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg, err := huobi.NewSubscriptionRequest("btcusdt") @@ -303,9 +304,9 @@ func TestCreateMessage(t *testing.T) { }, { name: "two currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, expected: func() []handlers.WebsocketEncodedMessage { bz1, err := huobi.NewSubscriptionRequest("btcusdt") @@ -317,24 +318,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one currency pair not in config", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(huobi.Name, huobi.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := huobi.NewWebSocketDataHandler(logger, marketConfig, huobi.DefaultWebSocketConfig) + wsHandler, err := huobi.NewWebSocketDataHandler(logger, huobi.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) diff --git a/providers/websockets/kraken/parse.go b/providers/websockets/kraken/parse.go index 993833de5..3b4e09a07 100644 --- a/providers/websockets/kraken/parse.go +++ b/providers/websockets/kraken/parse.go @@ -93,7 +93,7 @@ func (h *WebSocketHandler) parseTickerMessage( } // Get the ticker from the instrument. - ticker, ok := h.market.OffChainMap[resp.Pair] + ticker, ok := h.cache.FromOffChainTicker(resp.Pair) if !ok { return types.NewPriceResponse(resolved, unResolved), fmt.Errorf("no ticker found for instrument %s", resp.Pair) @@ -107,7 +107,7 @@ func (h *WebSocketHandler) parseTickerMessage( // Parse the price update. priceStr := resp.TickerData.VolumeWeightedAveragePrice[TodayPriceIndex] - price, err := math.Float64StringToBigInt(priceStr, ticker.Decimals) + price, err := math.Float64StringToBigFloat(priceStr) if err != nil { wErr := fmt.Errorf("failed to parse price %s: %w", priceStr, err) unResolved[ticker] = providertypes.UnresolvedResult{ diff --git a/providers/websockets/kraken/utils.go b/providers/websockets/kraken/utils.go index eacdb2afd..6eea928db 100644 --- a/providers/websockets/kraken/utils.go +++ b/providers/websockets/kraken/utils.go @@ -43,153 +43,116 @@ var ( } // DefaultMarketConfig is the default market configuration for Kraken. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USD: { - Name: Name, OffChainTicker: "APE/USD", }, constants.ATOM_USD: { - Name: Name, OffChainTicker: "ATOM/USD", }, constants.AVAX_USD: { - Name: Name, OffChainTicker: "AVAX/USD", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX/USDT", }, constants.BCH_USD: { - Name: Name, OffChainTicker: "BCH/USD", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "XBT/USD", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "XBT/USDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "XBT/USDT", }, constants.BLUR_USD: { - Name: Name, OffChainTicker: "BLUR/USD", }, constants.CARDANO_USD: { - Name: Name, OffChainTicker: "ADA/USD", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "TIA/USD", }, constants.CHAINLINK_USD: { - Name: Name, OffChainTicker: "LINK/USD", }, constants.COMPOUND_USD: { - Name: Name, OffChainTicker: "COMP/USD", }, constants.CURVE_USD: { - Name: Name, OffChainTicker: "CRV/USD", }, constants.DOGE_USD: { - Name: Name, OffChainTicker: "XDG/USD", }, constants.DYDX_USD: { - Name: Name, OffChainTicker: "DYDX/USD", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH/XBT", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ETH/USD", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETH/USDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH/USDT", }, constants.FILECOIN_USD: { - Name: Name, OffChainTicker: "FIL/USD", }, constants.LIDO_USD: { - Name: Name, OffChainTicker: "LDO/USD", }, constants.LITECOIN_USD: { - Name: Name, OffChainTicker: "XLTCZ/USD", }, constants.MAKER_USD: { - Name: Name, OffChainTicker: "MKR/USD", }, constants.PEPE_USD: { - Name: Name, OffChainTicker: "PEPE/USD", }, constants.POLKADOT_USD: { - Name: Name, OffChainTicker: "DOT/USD", }, constants.POLYGON_USD: { - Name: Name, OffChainTicker: "MATIC/USD", }, constants.RIPPLE_USD: { - Name: Name, OffChainTicker: "XXRPZ/USD", }, constants.SHIBA_USD: { - Name: Name, OffChainTicker: "SHIB/USD", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOL/USD", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL/USDT", }, constants.STELLAR_USD: { - Name: Name, OffChainTicker: "XXLMZ/USD", }, constants.TRON_USD: { - Name: Name, OffChainTicker: "TRX/USD", }, constants.UNISWAP_USD: { - Name: Name, OffChainTicker: "UNI/USD", }, constants.USDC_USD: { - Name: Name, OffChainTicker: "USDC/USD", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDC/USDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDT/USD", }, } diff --git a/providers/websockets/kraken/ws_data_handler.go b/providers/websockets/kraken/ws_data_handler.go index c7c027713..f79683a54 100644 --- a/providers/websockets/kraken/ws_data_handler.go +++ b/providers/websockets/kraken/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,26 +18,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the Kraken API. - market types.ProviderMarketMap // ws is the config for the Kraken websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Kraken PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -53,8 +43,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -101,17 +91,13 @@ func (h *WebSocketHandler) HandleMessage( // subscribe to the given tickers. This is called when the connection to the data provider // is first established. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - instruments = append(instruments, market.OffChainTicker) + instruments = append(instruments, ticker.GetOffChainTicker()) + h.cache.Add(ticker) } return NewSubscribeRequestMessage(instruments) @@ -126,7 +112,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/kraken/ws_data_handler_test.go b/providers/websockets/kraken/ws_data_handler_test.go index 0d9eead88..074ba41c1 100644 --- a/providers/websockets/kraken/ws_data_handler_test.go +++ b/providers/websockets/kraken/ws_data_handler_test.go @@ -12,12 +12,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/kraken" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( + btcusd = kraken.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USD) + ethusd = kraken.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USD) logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) ) func TestHandleMessage(t *testing.T) { @@ -35,8 +35,8 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USD: { - Value: big.NewInt(4259641907000), + btcusd: { + Value: big.NewFloat(42596.41907000), }, }, UnResolved: types.UnResolvedPrices{}, @@ -193,10 +193,11 @@ func TestHandleMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(kraken.Name, kraken.DefaultMarketConfig) + handler, err := kraken.NewWebSocketDataHandler(logger, kraken.DefaultWebSocketConfig) require.NoError(t, err) - handler, err := kraken.NewWebSocketDataHandler(logger, marketConfig, kraken.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = handler.CreateMessages([]types.ProviderTicker{btcusd, ethusd}) require.NoError(t, err) resp, updateMsg, err := handler.HandleMessage(tc.msg()) @@ -215,7 +216,7 @@ func TestHandleMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -229,13 +230,13 @@ func TestHandleMessage(t *testing.T) { func TestCreateMessage(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -243,8 +244,8 @@ func TestCreateMessage(t *testing.T) { }, { name: "single currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, + cps: []types.ProviderTicker{ + btcusd, }, expected: func() []handlers.WebsocketEncodedMessage { msg := kraken.SubscribeRequestMessage{ @@ -264,9 +265,9 @@ func TestCreateMessage(t *testing.T) { }, { name: "multiple currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - constants.ETHEREUM_USD, + cps: []types.ProviderTicker{ + btcusd, + ethusd, }, expected: func() []handlers.WebsocketEncodedMessage { msg := kraken.SubscribeRequestMessage{ @@ -284,36 +285,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one known and one unknown currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USD, - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - msg := kraken.SubscribeRequestMessage{ - Event: string(kraken.SubscribeEvent), - Pair: []string{"XBT/USD"}, - Subscription: kraken.Subscription{ - Name: string(kraken.TickerChannel), - }, - } - - bz, err := json.Marshal(msg) - require.NoError(t, err) - - return []handlers.WebsocketEncodedMessage{bz} - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(kraken.Name, kraken.DefaultMarketConfig) - require.NoError(t, err) - - handler, err := kraken.NewWebSocketDataHandler(logger, marketConfig, kraken.DefaultWebSocketConfig) + handler, err := kraken.NewWebSocketDataHandler(logger, kraken.DefaultWebSocketConfig) require.NoError(t, err) actual, err := handler.CreateMessages(tc.cps) diff --git a/providers/websockets/kucoin/parse.go b/providers/websockets/kucoin/parse.go index 7398ec500..45ba0300a 100644 --- a/providers/websockets/kucoin/parse.go +++ b/providers/websockets/kucoin/parse.go @@ -36,7 +36,7 @@ func (h *WebSocketHandler) parseTickerResponseMessage( // Parse the currency pair from the ticker data. offChainTicker := tickerData[TickerIndex] - ticker, ok := h.market.OffChainMap[offChainTicker] + ticker, ok := h.cache.FromOffChainTicker(offChainTicker) if !ok { return types.NewPriceResponse(resolved, unResolved), fmt.Errorf("market not found for ticker %s", offChainTicker) @@ -71,7 +71,7 @@ func (h *WebSocketHandler) parseTickerResponseMessage( } // Parse the price from the message. - price, err := math.Float64StringToBigInt(msg.Data.Price, ticker.Decimals) + price, err := math.Float64StringToBigFloat(msg.Data.Price) if err != nil { wErr := fmt.Errorf("failed to parse price %w", err) unResolved[ticker] = providertypes.UnresolvedResult{ @@ -80,6 +80,6 @@ func (h *WebSocketHandler) parseTickerResponseMessage( return types.NewPriceResponse(resolved, unResolved), err } - resolved[ticker] = types.NewPriceResult(price, time.Now()) + resolved[ticker] = types.NewPriceResult(price, time.Now().UTC()) return types.NewPriceResponse(resolved, unResolved), nil } diff --git a/providers/websockets/kucoin/utils.go b/providers/websockets/kucoin/utils.go index f36552d52..81e7fda21 100644 --- a/providers/websockets/kucoin/utils.go +++ b/providers/websockets/kucoin/utils.go @@ -59,177 +59,134 @@ var ( } // DefaultMarketConfig defines the default market config for Kucoin. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USDC: { - Name: Name, OffChainTicker: "APE-USDC", }, constants.APE_USDT: { - Name: Name, OffChainTicker: "APE-USDT", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APT-USDT", }, constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARB-USDT", }, constants.ATOM_USDC: { - Name: Name, OffChainTicker: "ATOM-USDC", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOM-USDT", }, constants.AVAX_USDC: { - Name: Name, OffChainTicker: "AVAX-USDC", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX-USDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCH-USDT", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTC-USDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC-USDT", }, constants.BLUR_USDT: { - Name: Name, OffChainTicker: "BLUR-USDT", }, constants.CARDANO_USDC: { - Name: Name, OffChainTicker: "ADA-USDC", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADA-USDT", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "TIA-USDT", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINK-USDT", }, constants.CURVE_USDT: { - Name: Name, OffChainTicker: "CRV-USDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGE-USDT", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDX-USDT", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "ETC-USDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH-BTC", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETH-USDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH-USDT", }, constants.LIDO_USDT: { - Name: Name, OffChainTicker: "LDO-USDT", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTC-USDT", }, constants.MAKER_USDT: { - Name: Name, OffChainTicker: "MKR-USDT", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "NEAR-USDT", }, constants.OPTIMISM_USDT: { - Name: Name, OffChainTicker: "OP-USDT", }, constants.OSMOSIS_USDT: { - Name: Name, OffChainTicker: "OSMO-USDT", }, constants.PEPE_USDT: { - Name: Name, OffChainTicker: "PEPE-USDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOT-USDT", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATIC-USDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRP-USDT", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "SEI-USDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIB-USDT", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOL-USDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL-USDT", }, constants.STELLAR_USDT: { - Name: Name, OffChainTicker: "XLM-USDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUI-USDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRX-USDT", }, constants.UNISWAP_USDT: { - Name: Name, OffChainTicker: "UNI-USDT", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDC-USDT", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLD-USDT", }, } diff --git a/providers/websockets/kucoin/ws_data_handler.go b/providers/websockets/kucoin/ws_data_handler.go index dcdecaaaf..b64872d54 100644 --- a/providers/websockets/kucoin/ws_data_handler.go +++ b/providers/websockets/kucoin/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,28 +18,19 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the KuCoin API. - market types.ProviderMarketMap // ws is the config for the KuCoin websocket. ws config.WebSocketConfig // sequences is a map of currency pair to sequence number. - sequences map[mmtypes.Ticker]int64 + sequences map[types.ProviderTicker]int64 + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new Kucoin PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -55,9 +45,9 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, - sequences: make(map[mmtypes.Ticker]int64), + sequences: make(map[types.ProviderTicker]int64), + cache: types.NewProviderTickers(), }, nil } @@ -120,17 +110,13 @@ func (h *WebSocketHandler) HandleMessage( // KuCoin websocket API. The subscribe messages are created based on the currency pairs // that are configured for the provider. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - instruments = append(instruments, market.OffChainTicker) + instruments = append(instruments, ticker.GetOffChainTicker()) + h.cache.Add(ticker) } return NewSubscribeRequestMessage(instruments) @@ -149,8 +135,8 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, - sequences: make(map[mmtypes.Ticker]int64), + sequences: make(map[types.ProviderTicker]int64), + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/kucoin/ws_data_handler_test.go b/providers/websockets/kucoin/ws_data_handler_test.go index 70873eb7c..9ab0e434c 100644 --- a/providers/websockets/kucoin/ws_data_handler_test.go +++ b/providers/websockets/kucoin/ws_data_handler_test.go @@ -16,12 +16,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/kucoin" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusdt = kucoin.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = kucoin.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + logger = zap.NewExample() ) func TestHandleMessage(t *testing.T) { @@ -119,8 +119,8 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(10000000), + btcusdt: { + Value: big.NewFloat(0.1), }, }, }, @@ -145,7 +145,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("error"), providertypes.ErrorWebSocketGeneral), }, }, @@ -171,7 +171,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("received out of order ticker response message"), providertypes.ErrorWebSocketGeneral), }, }, @@ -213,7 +213,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("failed to parse price %s", "failed to parse float64 string to big int: invalid"), providertypes.ErrorWebSocketGeneral), }, }, @@ -261,10 +261,11 @@ func TestHandleMessage(t *testing.T) { }, } - marketConfig, err := types.NewProviderMarketMap(kucoin.Name, kucoin.DefaultMarketConfig) + handler, err := kucoin.NewWebSocketDataHandler(logger, kucoin.DefaultWebSocketConfig) require.NoError(t, err) - handler, err := kucoin.NewWebSocketDataHandler(logger, marketConfig, kucoin.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = handler.CreateMessages([]types.ProviderTicker{btcusdt, ethusdt}) require.NoError(t, err) for _, tc := range testCases { @@ -291,7 +292,7 @@ func TestHandleMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -305,13 +306,13 @@ func TestHandleMessage(t *testing.T) { func TestCreateMessages(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -319,8 +320,8 @@ func TestCreateMessages(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := kucoin.SubscribeRequestMessage{ @@ -343,9 +344,9 @@ func TestCreateMessages(t *testing.T) { }, { name: "multiple currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := kucoin.SubscribeRequestMessage{ @@ -367,26 +368,11 @@ func TestCreateMessages(t *testing.T) { }, expectedErr: false, }, - { - name: "multiple currency pairs with one not found in market configs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(kucoin.Name, kucoin.DefaultMarketConfig) - require.NoError(t, err) - - handler, err := kucoin.NewWebSocketDataHandler(logger, marketConfig, kucoin.DefaultWebSocketConfig) + handler, err := kucoin.NewWebSocketDataHandler(logger, kucoin.DefaultWebSocketConfig) require.NoError(t, err) actual, err := handler.CreateMessages(tc.cps) diff --git a/providers/websockets/mexc/parse.go b/providers/websockets/mexc/parse.go index cbaeff7da..afd583446 100644 --- a/providers/websockets/mexc/parse.go +++ b/providers/websockets/mexc/parse.go @@ -21,7 +21,7 @@ func (h *WebSocketHandler) parseTickerResponseMessage( unResolved = make(types.UnResolvedPrices) ) - ticker, ok := h.market.OffChainMap[msg.Data.Symbol] + ticker, ok := h.cache.FromOffChainTicker(msg.Data.Symbol) if !ok { return types.NewPriceResponse(resolved, unResolved), fmt.Errorf("unknown ticker %s", msg.Data.Symbol) @@ -37,7 +37,7 @@ func (h *WebSocketHandler) parseTickerResponseMessage( } // Convert the price. - price, err := math.Float64StringToBigInt(msg.Data.Price, ticker.Decimals) + price, err := math.Float64StringToBigFloat(msg.Data.Price) if err != nil { unResolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(err, providertypes.ErrorFailedToParsePrice), diff --git a/providers/websockets/mexc/utils.go b/providers/websockets/mexc/utils.go index 0570f57c9..db921f4ee 100644 --- a/providers/websockets/mexc/utils.go +++ b/providers/websockets/mexc/utils.go @@ -50,169 +50,128 @@ var ( } // DefaultMarketConfig is the default market configuration for the MEXC Websocket. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USDT: { - Name: Name, OffChainTicker: "APEUSDT", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APTUSDT", }, constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARBUSDT", }, constants.ATOM_USDC: { - Name: Name, OffChainTicker: "ATOMUSDC", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOMUSDT", }, constants.AVAX_USDC: { - Name: Name, OffChainTicker: "AVAXUSDC", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAXUSDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCHUSDT", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTCUSDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTCUSDT", }, constants.BLUR_USDT: { - Name: Name, OffChainTicker: "BLURUSDT", }, constants.CARDANO_USDC: { - Name: Name, OffChainTicker: "ADAUSDC", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADAUSDT", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINKUSDT", }, constants.COMPOUND_USDT: { - Name: Name, OffChainTicker: "COMPUSDT", }, constants.CURVE_USDT: { - Name: Name, OffChainTicker: "CRVUSDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGEUSDT", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDXUSDT", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "ETCUSDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETHBTC", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETHUSDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETHUSDT", }, constants.FILECOIN_USDT: { - Name: Name, OffChainTicker: "FILUSDT", }, constants.LIDO_USDT: { - Name: Name, OffChainTicker: "LDOUSDT", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTCUSDT", }, constants.MAKER_USDT: { - Name: Name, OffChainTicker: "MKRUSDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOTUSDT", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "NEARUSDT", }, constants.OPTIMISM_USDT: { - Name: Name, OffChainTicker: "OPUSDT", }, constants.PEPE_USDT: { - Name: Name, OffChainTicker: "PEPEUSDT", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATICUSDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRPUSDT", }, constants.SEI_USDT: { - Name: Name, OffChainTicker: "SEIUSDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIBUSDT", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOLUSDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOLUSDT", }, constants.STELLAR_USDT: { - Name: Name, OffChainTicker: "XLMUSDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUIUSDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRXUSDT", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDCUSDT", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLDUSDT", }, } diff --git a/providers/websockets/mexc/ws_data_handler.go b/providers/websockets/mexc/ws_data_handler.go index c73641c55..3d63051a9 100644 --- a/providers/websockets/mexc/ws_data_handler.go +++ b/providers/websockets/mexc/ws_data_handler.go @@ -10,7 +10,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -20,26 +19,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the MEXC API. - market types.ProviderMarketMap // ws is the config for the MEXC websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new MEXC PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -54,8 +44,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -107,7 +97,7 @@ func (h *WebSocketHandler) HandleMessage( // subscribe to the given ticker. This is called when the connection to the data provider is // first established. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { if len(tickers) > MaxSubscriptionsPerConnection { return nil, fmt.Errorf("cannot subscribe to more than %d tickers per connection", MaxSubscriptionsPerConnection) @@ -116,13 +106,9 @@ func (h *WebSocketHandler) CreateMessages( instruments := make([]string, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - - mexcTicker := fmt.Sprintf("%s%s%s", string(MiniTickerChannel), strings.ToUpper(market.OffChainTicker), "@UTC+8") + mexcTicker := fmt.Sprintf("%s%s%s", string(MiniTickerChannel), strings.ToUpper(ticker.GetOffChainTicker()), "@UTC+8") instruments = append(instruments, mexcTicker) + h.cache.Add(ticker) } return NewSubscribeRequestMessage(instruments) @@ -138,7 +124,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/mexc/ws_data_handler_test.go b/providers/websockets/mexc/ws_data_handler_test.go index 5fbccb507..f07770301 100644 --- a/providers/websockets/mexc/ws_data_handler_test.go +++ b/providers/websockets/mexc/ws_data_handler_test.go @@ -13,12 +13,13 @@ import ( "github.com/skip-mev/slinky/providers/base/websocket/handlers" providertypes "github.com/skip-mev/slinky/providers/types" "github.com/skip-mev/slinky/providers/websockets/mexc" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USD", 8, 1) + btcusdt = mexc.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = mexc.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + atomusdc = mexc.DefaultMarketConfig.MustGetProviderTicker(constants.ATOM_USDC) + logger = zap.NewExample() ) func TestHandleMessage(t *testing.T) { @@ -70,8 +71,8 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ Resolved: types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(1000000000000), + btcusdt: { + Value: big.NewFloat(10000.00), }, }, }, @@ -100,7 +101,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("invalid channel"), providertypes.ErrorWebSocketGeneral), }, }, @@ -118,7 +119,7 @@ func TestHandleMessage(t *testing.T) { }, resp: types.PriceResponse{ UnResolved: types.UnResolvedPrices{ - constants.BITCOIN_USDT: providertypes.UnresolvedResult{ + btcusdt: providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(fmt.Errorf("invalid price"), providertypes.ErrorWebSocketGeneral), }, }, @@ -132,10 +133,11 @@ func TestHandleMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(mexc.Name, mexc.DefaultMarketConfig) + wsHandler, err := mexc.NewWebSocketDataHandler(logger, mexc.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := mexc.NewWebSocketDataHandler(logger, marketConfig, mexc.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusdt, ethusdt, atomusdc}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -157,7 +159,7 @@ func TestHandleMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -171,14 +173,14 @@ func TestHandleMessage(t *testing.T) { func TestCreateMessages(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "single currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := `{"method":"SUBSCRIPTION","params":["spot@public.miniTicker.v3.api@BTCUSDT@UTC+8"]}` @@ -188,10 +190,10 @@ func TestCreateMessages(t *testing.T) { }, { name: "multiple currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, - constants.ATOM_USDC, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, + atomusdc, }, expected: func() []handlers.WebsocketEncodedMessage { msg := `{"method":"SUBSCRIPTION","params":["spot@public.miniTicker.v3.api@BTCUSDT@UTC+8","spot@public.miniTicker.v3.api@ETHUSDT@UTC+8","spot@public.miniTicker.v3.api@ATOMUSDC@UTC+8"]}` @@ -199,22 +201,11 @@ func TestCreateMessages(t *testing.T) { }, expectedErr: false, }, - { - name: "unsupported currency pair", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { return nil }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(mexc.Name, mexc.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := mexc.NewWebSocketDataHandler(logger, marketConfig, mexc.DefaultWebSocketConfig) + wsHandler, err := mexc.NewWebSocketDataHandler(logger, mexc.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) @@ -228,10 +219,7 @@ func TestCreateMessages(t *testing.T) { } func TestHeartBeatMessages(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(mexc.Name, mexc.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := mexc.NewWebSocketDataHandler(logger, marketConfig, mexc.DefaultWebSocketConfig) + wsHandler, err := mexc.NewWebSocketDataHandler(logger, mexc.DefaultWebSocketConfig) require.NoError(t, err) expected := []handlers.WebsocketEncodedMessage{ diff --git a/providers/websockets/okx/parse.go b/providers/websockets/okx/parse.go index d1c350d3a..463fc3548 100644 --- a/providers/websockets/okx/parse.go +++ b/providers/websockets/okx/parse.go @@ -84,16 +84,16 @@ func (h *WebSocketHandler) parseTickerResponseMessage( // Iterate through all tickers and add them to the response. for _, instrument := range resp.Data { - ticker, ok := h.market.OffChainMap[instrument.ID] + ticker, ok := h.cache.FromOffChainTicker(instrument.ID) if !ok { h.logger.Debug("ticker not found for instrument ID", zap.String("instrument_id", instrument.ID)) continue } - // Convert the price to a big.Int. - price, err := math.Float64StringToBigInt(instrument.IndexPrice, ticker.Decimals) + // Convert the price to a big.Float. + price, err := math.Float64StringToBigFloat(instrument.IndexPrice) if err != nil { - wErr := fmt.Errorf("failed to convert price to big.Int: %w", err) + wErr := fmt.Errorf("failed to convert price to big.Float: %w", err) unresolved[ticker] = providertypes.UnresolvedResult{ ErrorWithCode: providertypes.NewErrorWithCode(wErr, providertypes.ErrorFailedToParsePrice), } diff --git a/providers/websockets/okx/utils.go b/providers/websockets/okx/utils.go index c49e9ebd4..7b2fa08a9 100644 --- a/providers/websockets/okx/utils.go +++ b/providers/websockets/okx/utils.go @@ -43,221 +43,167 @@ var ( } // DefaultMarketConfig is the default market configuration for OKX. - DefaultMarketConfig = types.TickerToProviderConfig{ + DefaultMarketConfig = types.CurrencyPairsToProviderTickers{ constants.APE_USDC: { - Name: Name, OffChainTicker: "APE-USDC", }, constants.APE_USDT: { - Name: Name, OffChainTicker: "APE-USDT", }, constants.APTOS_USDC: { - Name: Name, OffChainTicker: "APT-USDC", }, constants.APTOS_USDT: { - Name: Name, OffChainTicker: "APT-USDT", }, constants.ARBITRUM_USDT: { - Name: Name, OffChainTicker: "ARB-USDT", }, constants.ATOM_USD: { - Name: Name, OffChainTicker: "ATOM-USD", }, constants.ATOM_USDC: { - Name: Name, OffChainTicker: "ATOM-USDC", }, constants.ATOM_USDT: { - Name: Name, OffChainTicker: "ATOM-USDT", }, constants.AVAX_USD: { - Name: Name, OffChainTicker: "AVAX-USD", }, constants.AVAX_USDC: { - Name: Name, OffChainTicker: "AVAX-USDC", }, constants.AVAX_USDT: { - Name: Name, OffChainTicker: "AVAX-USDT", }, constants.BCH_USDT: { - Name: Name, OffChainTicker: "BCH-USDT", }, constants.BITCOIN_USD: { - Name: Name, OffChainTicker: "BTC-USD", }, constants.BITCOIN_USDC: { - Name: Name, OffChainTicker: "BTC-USDC", }, constants.BITCOIN_USDT: { - Name: Name, OffChainTicker: "BTC-USDT", }, constants.BLUR_USDT: { - Name: Name, OffChainTicker: "BLUR-USDT", }, constants.CARDANO_USD: { - Name: Name, OffChainTicker: "ADA-USD", }, constants.CARDANO_USDC: { - Name: Name, OffChainTicker: "ADA-USDC", }, constants.CARDANO_USDT: { - Name: Name, OffChainTicker: "ADA-USDT", }, constants.CELESTIA_USD: { - Name: Name, OffChainTicker: "TIA-USD", }, constants.CELESTIA_USDT: { - Name: Name, OffChainTicker: "TIA-USDT", }, constants.CHAINLINK_USDT: { - Name: Name, OffChainTicker: "LINK-USDT", }, constants.COMPOUND_USDT: { - Name: Name, OffChainTicker: "COMP-USDT", }, constants.CURVE_USDT: { - Name: Name, OffChainTicker: "CRV-USDT", }, constants.DOGE_USDT: { - Name: Name, OffChainTicker: "DOGE-USDT", }, constants.DYDX_USD: { - Name: Name, OffChainTicker: "DYDX-USD", }, constants.DYDX_USDT: { - Name: Name, OffChainTicker: "DYDX-USDT", }, constants.ETC_USDT: { - Name: Name, OffChainTicker: "ETC-USDT", }, constants.ETHEREUM_BITCOIN: { - Name: Name, OffChainTicker: "ETH-BTC", }, constants.ETHEREUM_USD: { - Name: Name, OffChainTicker: "ETH-USD", }, constants.ETHEREUM_USDC: { - Name: Name, OffChainTicker: "ETH-USDC", }, constants.ETHEREUM_USDT: { - Name: Name, OffChainTicker: "ETH-USDT", }, constants.FILECOIN_USDT: { - Name: Name, OffChainTicker: "FIL-USDT", }, constants.LIDO_USDT: { - Name: Name, OffChainTicker: "LDO-USDT", }, constants.LITECOIN_USDT: { - Name: Name, OffChainTicker: "LTC-USDT", }, constants.MAKER_USDT: { - Name: Name, OffChainTicker: "MKR-USDT", }, constants.POLKADOT_USDT: { - Name: Name, OffChainTicker: "DOT-USDT", }, constants.POLYGON_USDT: { - Name: Name, OffChainTicker: "MATIC-USDT", }, constants.NEAR_USDT: { - Name: Name, OffChainTicker: "NEAR-USDT", }, constants.OPTIMISM_USDT: { - Name: Name, OffChainTicker: "OP-USDT", }, constants.PEPE_USDT: { - Name: Name, OffChainTicker: "PEPE-USDT", }, constants.RIPPLE_USDT: { - Name: Name, OffChainTicker: "XRP-USDT", }, constants.SHIBA_USDT: { - Name: Name, OffChainTicker: "SHIB-USDT", }, constants.SOLANA_USD: { - Name: Name, OffChainTicker: "SOL-USD", }, constants.SOLANA_USDC: { - Name: Name, OffChainTicker: "SOL-USDC", }, constants.SOLANA_USDT: { - Name: Name, OffChainTicker: "SOL-USDT", }, constants.STELLAR_USDT: { - Name: Name, OffChainTicker: "XLM-USDT", }, constants.SUI_USDT: { - Name: Name, OffChainTicker: "SUI-USDT", }, constants.TRON_USDT: { - Name: Name, OffChainTicker: "TRX-USDT", }, constants.UNISWAP_USDT: { - Name: Name, OffChainTicker: "UNI-USDT", }, constants.USDC_USD: { - Name: Name, OffChainTicker: "USDC-USD", }, constants.USDC_USDT: { - Name: Name, OffChainTicker: "USDC-USDT", }, constants.USDT_USD: { - Name: Name, OffChainTicker: "USDT-USD", }, constants.WORLD_USDT: { - Name: Name, OffChainTicker: "WLD-USDT", }, } diff --git a/providers/websockets/okx/ws_data_handler.go b/providers/websockets/okx/ws_data_handler.go index 5741199b5..5389e2cef 100644 --- a/providers/websockets/okx/ws_data_handler.go +++ b/providers/websockets/okx/ws_data_handler.go @@ -9,7 +9,6 @@ import ( "github.com/skip-mev/slinky/oracle/config" "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) @@ -19,26 +18,17 @@ var _ types.PriceWebSocketDataHandler = (*WebSocketHandler)(nil) type WebSocketHandler struct { logger *zap.Logger - // market is the config for the OKX API. - market types.ProviderMarketMap // ws is the config for the OKX websocket. ws config.WebSocketConfig + // cache maintains the latest set of tickers seen by the handler. + cache types.ProviderTickers } // NewWebSocketDataHandler returns a new OKX PriceWebSocketDataHandler. func NewWebSocketDataHandler( logger *zap.Logger, - market types.ProviderMarketMap, ws config.WebSocketConfig, ) (types.PriceWebSocketDataHandler, error) { - if err := market.ValidateBasic(); err != nil { - return nil, fmt.Errorf("invalid market config for %s: %w", Name, err) - } - - if market.Name != Name { - return nil, fmt.Errorf("expected market config name %s, got %s", Name, market.Name) - } - if ws.Name != Name { return nil, fmt.Errorf("expected websocket config name %s, got %s", Name, ws.Name) } @@ -53,8 +43,8 @@ func NewWebSocketDataHandler( return &WebSocketHandler{ logger: logger, - market: market, ws: ws, + cache: types.NewProviderTickers(), }, nil } @@ -123,19 +113,15 @@ func (h *WebSocketHandler) HandleMessage( // Only the currency pairs that are specified in the config are subscribed to. The only channel // that is subscribed to is the index tickers channel - which supports spot markets. func (h *WebSocketHandler) CreateMessages( - tickers []mmtypes.Ticker, + tickers []types.ProviderTicker, ) ([]handlers.WebsocketEncodedMessage, error) { instruments := make([]SubscriptionTopic, 0) for _, ticker := range tickers { - market, ok := h.market.TickerConfigs[ticker] - if !ok { - return nil, fmt.Errorf("ticker not found in market configs %s", ticker.String()) - } - instruments = append(instruments, SubscriptionTopic{ Channel: string(IndexTickersChannel), - InstrumentID: market.OffChainTicker, + InstrumentID: ticker.GetOffChainTicker(), }) + h.cache.Add(ticker) } return NewSubscribeToTickersRequestMessage(instruments) @@ -150,7 +136,7 @@ func (h *WebSocketHandler) HeartBeatMessages() ([]handlers.WebsocketEncodedMessa func (h *WebSocketHandler) Copy() types.PriceWebSocketDataHandler { return &WebSocketHandler{ logger: h.logger, - market: h.market, ws: h.ws, + cache: types.NewProviderTickers(), } } diff --git a/providers/websockets/okx/ws_data_handler_test.go b/providers/websockets/okx/ws_data_handler_test.go index 0c5ac9188..168d7708e 100644 --- a/providers/websockets/okx/ws_data_handler_test.go +++ b/providers/websockets/okx/ws_data_handler_test.go @@ -13,15 +13,15 @@ import ( "github.com/skip-mev/slinky/oracle/types" "github.com/skip-mev/slinky/providers/base/websocket/handlers" "github.com/skip-mev/slinky/providers/websockets/okx" - mmtypes "github.com/skip-mev/slinky/x/marketmap/types" ) var ( - logger = zap.NewExample() - mogusd = mmtypes.NewTicker("MOG", "USDT", 8, 1) + btcusdt = okx.DefaultMarketConfig.MustGetProviderTicker(constants.BITCOIN_USDT) + ethusdt = okx.DefaultMarketConfig.MustGetProviderTicker(constants.ETHEREUM_USDT) + logger = zap.NewExample() ) -func TestHandlerMessage(t *testing.T) { +func TestHandleMessage(t *testing.T) { testCases := []struct { name string msg func() []byte @@ -77,8 +77,8 @@ func TestHandlerMessage(t *testing.T) { }, resp: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(100000000), + btcusdt: { + Value: big.NewFloat(1.0), }, }, types.UnResolvedPrices{}, @@ -113,11 +113,11 @@ func TestHandlerMessage(t *testing.T) { }, resp: types.NewPriceResponse( types.ResolvedPrices{ - constants.BITCOIN_USDT: { - Value: big.NewInt(100000000), + btcusdt: { + Value: big.NewFloat(1.0), }, - constants.ETHEREUM_USDT: { - Value: big.NewInt(200000000), + ethusdt: { + Value: big.NewFloat(2.0), }, }, types.UnResolvedPrices{}, @@ -290,10 +290,11 @@ func TestHandlerMessage(t *testing.T) { for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(okx.Name, okx.DefaultMarketConfig) + wsHandler, err := okx.NewWebSocketDataHandler(logger, okx.DefaultWebSocketConfig) require.NoError(t, err) - wsHandler, err := okx.NewWebSocketDataHandler(logger, marketConfig, okx.DefaultWebSocketConfig) + // Update the cache since it is assumed that CreateMessages is executed before anything else. + _, err = wsHandler.CreateMessages([]types.ProviderTicker{btcusdt, ethusdt}) require.NoError(t, err) resp, updateMsg, err := wsHandler.HandleMessage(tc.msg()) @@ -309,7 +310,7 @@ func TestHandlerMessage(t *testing.T) { for cp, result := range tc.resp.Resolved { require.Contains(t, resp.Resolved, cp) - require.Equal(t, result.Value, resp.Resolved[cp].Value) + require.Equal(t, result.Value.SetPrec(18), resp.Resolved[cp].Value.SetPrec(18)) } for cp := range tc.resp.UnResolved { @@ -323,13 +324,13 @@ func TestHandlerMessage(t *testing.T) { func TestCreateMessage(t *testing.T) { testCases := []struct { name string - cps []mmtypes.Ticker + cps []types.ProviderTicker expected func() []handlers.WebsocketEncodedMessage expectedErr bool }{ { name: "no currency pairs", - cps: []mmtypes.Ticker{}, + cps: []types.ProviderTicker{}, expected: func() []handlers.WebsocketEncodedMessage { return nil }, @@ -337,8 +338,8 @@ func TestCreateMessage(t *testing.T) { }, { name: "one currency pair", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, + cps: []types.ProviderTicker{ + btcusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := okx.SubscribeRequestMessage{ @@ -360,9 +361,9 @@ func TestCreateMessage(t *testing.T) { }, { name: "two currency pairs", - cps: []mmtypes.Ticker{ - constants.BITCOIN_USDT, - constants.ETHEREUM_USDT, + cps: []types.ProviderTicker{ + btcusdt, + ethusdt, }, expected: func() []handlers.WebsocketEncodedMessage { msg := okx.SubscribeRequestMessage{ @@ -386,24 +387,11 @@ func TestCreateMessage(t *testing.T) { }, expectedErr: false, }, - { - name: "one currency pair not in config", - cps: []mmtypes.Ticker{ - mogusd, - }, - expected: func() []handlers.WebsocketEncodedMessage { - return nil - }, - expectedErr: true, - }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - marketConfig, err := types.NewProviderMarketMap(okx.Name, okx.DefaultMarketConfig) - require.NoError(t, err) - - wsHandler, err := okx.NewWebSocketDataHandler(logger, marketConfig, okx.DefaultWebSocketConfig) + wsHandler, err := okx.NewWebSocketDataHandler(logger, okx.DefaultWebSocketConfig) require.NoError(t, err) msgs, err := wsHandler.CreateMessages(tc.cps) diff --git a/scripts/protocgen-pulsar.sh b/scripts/protocgen-pulsar.sh index 7d042569b..682c49e7d 100644 --- a/scripts/protocgen-pulsar.sh +++ b/scripts/protocgen-pulsar.sh @@ -34,9 +34,5 @@ sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/sl echo "fixing market.pulsar.go" sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/marketmap/v1/market.pulsar.go && rm ./api/slinky/marketmap/v1/market.pulsar.go.bak +sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/marketmap/v1/query.pulsar.go && rm ./api/slinky/marketmap/v1/query.pulsar.go.bak sed -i.bak 's|cosmossdk.io/api/slinky/oracle/v1|github.com/skip-mev/slinky/api/slinky/oracle/v1|g' ./api/slinky/marketmap/v1/market.pulsar.go && rm ./api/slinky/marketmap/v1/market.pulsar.go.bak - -echo "fixing market.pulsar.go" -sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/mm2/v1/market.pulsar.go && rm ./api/slinky/mm2/v1/market.pulsar.go.bak -sed -i.bak 's|cosmossdk.io/api/slinky/types/v1|github.com/skip-mev/slinky/api/slinky/types/v1|g' ./api/slinky/mm2/v1/query.pulsar.go && rm ./api/slinky/mm2/v1/query.pulsar.go.bak -sed -i.bak 's|cosmossdk.io/api/slinky/oracle/v1|github.com/skip-mev/slinky/api/slinky/oracle/v1|g' ./api/slinky/mm2/v1/market.pulsar.go && rm ./api/slinky/mm2/v1/market.pulsar.go.bak diff --git a/service/clients/marketmap/types/types.go b/service/clients/marketmap/types/types.go index 52fc605b9..62fdf8cc7 100644 --- a/service/clients/marketmap/types/types.go +++ b/service/clients/marketmap/types/types.go @@ -31,7 +31,7 @@ func (mms Chain) String() string { type ( // MarketMapProvider is a type alias for the market map provider. - MarketMapProvider = base.Provider[Chain, *mmtypes.GetMarketMapResponse] + MarketMapProvider = base.Provider[Chain, *mmtypes.MarketMapResponse] // MarketMapFactory is a type alias for the market map factory. MarketMapFactory = func( @@ -44,19 +44,19 @@ type ( // MarketMapAPIQueryHandler is a type alias for the market map API query handler. This // is responsible for querying the market map API and returning the resolved and unresolved // market map data. - MarketMapAPIQueryHandler = apihandlers.APIQueryHandler[Chain, *mmtypes.GetMarketMapResponse] + MarketMapAPIQueryHandler = apihandlers.APIQueryHandler[Chain, *mmtypes.MarketMapResponse] // MarketMapAPIDataHandler is a type alias for the market map API data handler. This // is responsible for parsing http responses and returning the resolved and unresolved // market map data. - MarketMapAPIDataHandler = apihandlers.APIDataHandler[Chain, *mmtypes.GetMarketMapResponse] + MarketMapAPIDataHandler = apihandlers.APIDataHandler[Chain, *mmtypes.MarketMapResponse] // MarketMapResponse is a type alias for the market map response. This is used to // represent the resolved and unresolved market map data. - MarketMapResponse = providertypes.GetResponse[Chain, *mmtypes.GetMarketMapResponse] + MarketMapResponse = providertypes.GetResponse[Chain, *mmtypes.MarketMapResponse] // MarketMapResult is a type alias for the market map result. - MarketMapResult = providertypes.ResolvedResult[*mmtypes.GetMarketMapResponse] + MarketMapResult = providertypes.ResolvedResult[*mmtypes.MarketMapResponse] // ResolvedMarketMap is a type alias for the resolved market map. ResolvedMarketMap = map[Chain]MarketMapResult @@ -67,17 +67,17 @@ type ( var ( // NewMarketMapResult is a function alias for the new market map result. - NewMarketMapResult = providertypes.NewResult[*mmtypes.GetMarketMapResponse] + NewMarketMapResult = providertypes.NewResult[*mmtypes.MarketMapResponse] // NewMarketMapResponse is a function alias for the new market map response. - NewMarketMapResponse = providertypes.NewGetResponse[Chain, *mmtypes.GetMarketMapResponse] + NewMarketMapResponse = providertypes.NewGetResponse[Chain, *mmtypes.MarketMapResponse] // NewMarketMapResponseWithErr returns a new market map response with an error. - NewMarketMapResponseWithErr = providertypes.NewGetResponseWithErr[Chain, *mmtypes.GetMarketMapResponse] + NewMarketMapResponseWithErr = providertypes.NewGetResponseWithErr[Chain, *mmtypes.MarketMapResponse] // NewMarketMapProvider is a function alias for the new market map provider. - NewMarketMapProvider = base.NewProvider[Chain, *mmtypes.GetMarketMapResponse] + NewMarketMapProvider = base.NewProvider[Chain, *mmtypes.MarketMapResponse] // NewMarketMapAPIQueryHandler is a function alias for the new market map API query handler. - NewMarketMapAPIQueryHandler = apihandlers.NewAPIQueryHandler[Chain, *mmtypes.GetMarketMapResponse] + NewMarketMapAPIQueryHandler = apihandlers.NewAPIQueryHandler[Chain, *mmtypes.MarketMapResponse] ) diff --git a/service/servers/oracle/helpers.go b/service/servers/oracle/helpers.go index 8b1d9d1be..12b5d9a98 100644 --- a/service/servers/oracle/helpers.go +++ b/service/servers/oracle/helpers.go @@ -4,11 +4,12 @@ import ( "github.com/skip-mev/slinky/oracle/types" ) -func ToReqPrices(prices types.TickerPrices) map[string]string { +func ToReqPrices(prices types.AggregatorPrices) map[string]string { reqPrices := make(map[string]string, len(prices)) for cp, price := range prices { - reqPrices[cp.String()] = price.String() + intPrice, _ := price.Int(nil) + reqPrices[cp] = intPrice.String() } return reqPrices diff --git a/service/servers/oracle/server_test.go b/service/servers/oracle/server_test.go index ccd0ba892..a94bff7fa 100644 --- a/service/servers/oracle/server_test.go +++ b/service/servers/oracle/server_test.go @@ -16,6 +16,7 @@ import ( "google.golang.org/grpc/status" "github.com/skip-mev/slinky/oracle/mocks" + "github.com/skip-mev/slinky/oracle/types" slinkytypes "github.com/skip-mev/slinky/pkg/types" client "github.com/skip-mev/slinky/service/clients/oracle" "github.com/skip-mev/slinky/service/metrics" @@ -140,9 +141,9 @@ func (s *ServerTestSuite) TestOracleServerPrices() { Decimals: 8, } - s.mockOracle.On("GetPrices").Return(map[mmtypes.Ticker]*big.Int{ - cp1: big.NewInt(100), - cp2: big.NewInt(200), + s.mockOracle.On("GetPrices").Return(types.AggregatorPrices{ + cp1.String(): big.NewFloat(100.1), + cp2.String(): big.NewFloat(200.1), }) ts := time.Now() s.mockOracle.On("GetLastSyncTime").Return(ts) diff --git a/tests/integration/slinky_integration_test.go b/tests/integration/slinky_integration_test.go index 13483e781..f8308ab83 100644 --- a/tests/integration/slinky_integration_test.go +++ b/tests/integration/slinky_integration_test.go @@ -4,10 +4,6 @@ import ( "fmt" "testing" - "github.com/skip-mev/slinky/x/incentives" - marketmapmodule "github.com/skip-mev/slinky/x/marketmap/module" - "github.com/skip-mev/slinky/x/sla" - "github.com/cosmos/cosmos-sdk/types/module/testutil" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/bank" @@ -19,7 +15,10 @@ import ( "github.com/skip-mev/slinky/tests/integration" "github.com/skip-mev/slinky/x/alerts" + "github.com/skip-mev/slinky/x/incentives" + marketmapmodule "github.com/skip-mev/slinky/x/marketmap" "github.com/skip-mev/slinky/x/oracle" + "github.com/skip-mev/slinky/x/sla" ) var ( diff --git a/tests/integration/slinky_setup.go b/tests/integration/slinky_setup.go index 876372334..d2929df92 100644 --- a/tests/integration/slinky_setup.go +++ b/tests/integration/slinky_setup.go @@ -12,6 +12,8 @@ import ( "testing" "time" + "github.com/skip-mev/slinky/providers/static" + "cosmossdk.io/math" abcitypes "github.com/cometbft/cometbft/abci/types" cmtabci "github.com/cometbft/cometbft/abci/types" @@ -138,6 +140,7 @@ func AddSidecarToNode(node *cosmos.ChainNode, conf ibc.SidecarConfig) { } // spin up the network (with side-cars enabled) + // BuildPOBInterchain creates a new Interchain testing env with the configured POB CosmosChain func BuildPOBInterchain(t *testing.T, ctx context.Context, chain ibc.Chain) *interchaintest.Interchain { ic := interchaintest.NewInterchain() @@ -298,7 +301,7 @@ func QueryCurrencyPair(chain *cosmos.CosmosChain, cp slinkytypes.CurrencyPair, h return res.Price, int64(res.Nonce), nil } -// Submit proposal creates and submits a proposal to the chain +// SubmitProposal creates and submits a proposal to the chain func SubmitProposal(chain *cosmos.CosmosChain, deposit sdk.Coin, submitter string, msgs ...sdk.Msg) (string, error) { // build the proposal rand := rand.Str(10) @@ -344,37 +347,26 @@ func PassProposal(chain *cosmos.CosmosChain, propId string, timeout time.Duratio // AddCurrencyPairs creates + submits the proposal to add the given currency-pairs to state, votes for the prop w/ all nodes, // and waits for the proposal to pass. func (s *SlinkyIntegrationSuite) AddCurrencyPairs(chain *cosmos.CosmosChain, authority, denom string, deposit int64, timeout time.Duration, user cosmos.User, cps ...slinkytypes.CurrencyPair) error { - creates := make([]mmtypes.CreateMarket, len(cps)) + creates := make([]mmtypes.Market, len(cps)) for i, cp := range cps { - creates[i] = mmtypes.CreateMarket{ + creates[i] = mmtypes.Market{ Ticker: mmtypes.Ticker{ CurrencyPair: cp, Decimals: 8, MinProviderCount: 1, Metadata_JSON: "", }, - Providers: mmtypes.Providers{ - Providers: []mmtypes.ProviderConfig{ - { - Name: "mexc", - OffChainTicker: cp.String(), - }, + ProviderConfigs: []mmtypes.ProviderConfig{ + { + Name: static.Name, + OffChainTicker: cp.String(), }, }, - Paths: mmtypes.Paths{Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{ - { - CurrencyPair: cp, - Invert: false, - Provider: "mexc", - }, - }}, - }}, } } - msg := &mmtypes.MsgUpdateMarketMap{ - Signer: s.user.FormattedAddress(), + msg := &mmtypes.MsgCreateMarkets{ + Authority: s.user.FormattedAddress(), CreateMarkets: creates, } diff --git a/tests/integration/slinky_slashing_setup.go b/tests/integration/slinky_slashing_setup.go index e061f10c3..9bbd38f2b 100644 --- a/tests/integration/slinky_slashing_setup.go +++ b/tests/integration/slinky_slashing_setup.go @@ -6,8 +6,6 @@ import ( "testing" "time" - "github.com/stretchr/testify/require" - "cosmossdk.io/math" cmtabci "github.com/cometbft/cometbft/abci/types" coretypes "github.com/cometbft/cometbft/rpc/core/types" @@ -19,6 +17,7 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" "github.com/strangelove-ventures/interchaintest/v8/testutil" + "github.com/stretchr/testify/require" "google.golang.org/grpc" "google.golang.org/grpc/credentials/insecure" @@ -162,7 +161,7 @@ func QueryValidators(chain *cosmos.CosmosChain) ([]stakingtypes.Validator, error } // UpdateNodePrices updates the price reported for a given ticker, from a specified node -func UpdateNodePrices(node *cosmos.ChainNode, ticker mmtypes.Ticker, price int64) error { +func UpdateNodePrices(node *cosmos.ChainNode, ticker mmtypes.Ticker, price float64) error { if err := StopOracle(node); err != nil { return err } @@ -184,32 +183,18 @@ func UpdateNodePrices(node *cosmos.ChainNode, ticker mmtypes.Ticker, price int64 }) marketConfig := mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - ticker.String(): ticker, - }, - Providers: map[string]mmtypes.Providers{ + Markets: map[string]mmtypes.Market{ ticker.String(): { - Providers: []mmtypes.ProviderConfig{ + Ticker: ticker, + ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: fmt.Sprintf("%d", price), + OffChainTicker: ticker.String(), + Metadata_JSON: fmt.Sprintf(`{"price": %f}`, price), }, }, }, }, - Paths: map[string]mmtypes.Paths{ - ticker.String(): { - Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{ - { - CurrencyPair: ticker.CurrencyPair, - Invert: false, - Provider: static.Name, - }, - }}, - }, - }, - }, } oracle := GetOracleSideCar(node) diff --git a/tests/integration/slinky_slashing_suite.go b/tests/integration/slinky_slashing_suite.go index c2ad1f60e..daea8ccc8 100644 --- a/tests/integration/slinky_slashing_suite.go +++ b/tests/integration/slinky_slashing_suite.go @@ -18,9 +18,9 @@ import ( "github.com/strangelove-ventures/interchaintest/v8/chain/cosmos" slinkyabci "github.com/skip-mev/slinky/abci/ve/types" - "github.com/skip-mev/slinky/oracle/constants" slinkytypes "github.com/skip-mev/slinky/pkg/types" alerttypes "github.com/skip-mev/slinky/x/alerts/types" + mmtypes "github.com/skip-mev/slinky/x/marketmap/types" oracletypes "github.com/skip-mev/slinky/x/oracle/types" ) @@ -1164,17 +1164,25 @@ func (s *SlinkySlashingIntegrationSuite) TestConclusionSubmission() { // update first validator's oracle to submit incorrect Prices nodes := s.chain.Nodes() + btcusdTicker := mmtypes.Ticker{ + CurrencyPair: cp, + Decimals: 8, + MinProviderCount: 1, + Enabled: true, + Metadata_JSON: `{"price": 150.0}`, + } + // update the first node to report incorrect Prices (too high) - s.Require().NoError(UpdateNodePrices(nodes[0], constants.BITCOIN_USD, 152)) + s.Require().NoError(UpdateNodePrices(nodes[0], btcusdTicker, 152)) // update the second node to report incorrect Prices (too low) - s.Require().NoError(UpdateNodePrices(nodes[1], constants.BITCOIN_USD, 148)) + s.Require().NoError(UpdateNodePrices(nodes[1], btcusdTicker, 148)) // update the third node to report correct Prices - s.Require().NoError(UpdateNodePrices(nodes[2], constants.BITCOIN_USD, honestPrice)) + s.Require().NoError(UpdateNodePrices(nodes[2], btcusdTicker, float64(honestPrice))) // update the fourth node to report correct Prices - s.Require().NoError(UpdateNodePrices(nodes[3], constants.BITCOIN_USD, honestPrice)) + s.Require().NoError(UpdateNodePrices(nodes[3], btcusdTicker, float64(honestPrice))) }) validatorsPreSlash, err := QueryValidators(s.chain) diff --git a/tests/integration/slinky_suite.go b/tests/integration/slinky_suite.go index dd83c93da..a46475381 100644 --- a/tests/integration/slinky_suite.go +++ b/tests/integration/slinky_suite.go @@ -7,7 +7,6 @@ import ( "time" "cosmossdk.io/math" - sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -153,8 +152,8 @@ func (s *SlinkyIntegrationSuite) SetupSuite() { s.user = users[0] resp, err := UpdateMarketMapParams(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.user, mmtypes.Params{ - MarketAuthority: s.user.FormattedAddress(), - Version: 0, + MarketAuthorities: []string{s.user.FormattedAddress()}, + Admin: s.user.FormattedAddress(), }) s.Require().NoError(err, resp) } @@ -234,10 +233,10 @@ func (s *SlinkyOracleIntegrationSuite) TestOracleModule() { } func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { - eth_usdc := constants.ETHEREUM_USDC + ethusdc := constants.ETHEREUM_USDC s.Require().NoError(s.AddCurrencyPairs(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.user, []slinkytypes.CurrencyPair{ - eth_usdc.CurrencyPair, + ethusdc, }...)) cc, close, err := GetChainGRPC(s.chain) @@ -245,7 +244,7 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { defer close() - id, err := getIDForCurrencyPair(context.Background(), oracletypes.NewQueryClient(cc), eth_usdc.CurrencyPair) + id, err := getIDForCurrencyPair(context.Background(), oracletypes.NewQueryClient(cc), ethusdc) s.Require().NoError(err) zero := big.NewInt(0) @@ -273,28 +272,22 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { }) marketConfig := mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - eth_usdc.String(): eth_usdc, - }, - Providers: map[string]mmtypes.Providers{ - eth_usdc.String(): { - Providers: []mmtypes.ProviderConfig{ + Markets: map[string]mmtypes.Market{ + ethusdc.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: ethusdc, + Decimals: 8, + MinProviderCount: 1, + }, + ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: "1140", + OffChainTicker: ethusdc.String(), + Metadata_JSON: `{"price": 1.1}`, }, }, }, }, - Paths: map[string]mmtypes.Paths{ - eth_usdc.String(): {Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{{ - CurrencyPair: eth_usdc.CurrencyPair, - Invert: false, - Provider: static.Name, - }}}, - }}, - }, } oracle := GetOracleSideCar(node) @@ -326,9 +319,9 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { }) s.Require().NoError(err) // query for the given currency pair - resp, _, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height) + resp, _, err := QueryCurrencyPair(s.chain, ethusdc, height) s.Require().NoError(err) - s.Require().Equal(resp.Price.Int64(), int64(1140)) + s.Require().Equal(resp.Price.Int64(), int64(110000000)) }) s.Run("single oracle down, price updates", func() { @@ -359,10 +352,10 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { }) s.Require().NoError(err) - _, oldNonce, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height-1) + _, oldNonce, err := QueryCurrencyPair(s.chain, ethusdc, height-1) s.Require().NoError(err) - _, newNonce, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height) + _, newNonce, err := QueryCurrencyPair(s.chain, ethusdc, height) s.Require().NoError(err) // expect update for height @@ -400,10 +393,10 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { }) s.Require().NoError(err) - _, oldNonce, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height-1) + _, oldNonce, err := QueryCurrencyPair(s.chain, ethusdc, height-1) s.Require().NoError(err) - _, newNonce, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height) + _, newNonce, err := QueryCurrencyPair(s.chain, ethusdc, height) s.Require().NoError(err) // expect update for height @@ -437,10 +430,10 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { }) s.Require().NoError(err) - _, oldNonce, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height-1) + _, oldNonce, err := QueryCurrencyPair(s.chain, ethusdc, height-1) s.Require().NoError(err) - _, newNonce, err := QueryCurrencyPair(s.chain, eth_usdc.CurrencyPair, height) + _, newNonce, err := QueryCurrencyPair(s.chain, ethusdc, height) s.Require().NoError(err) // expect no update for the height @@ -454,15 +447,15 @@ func (s *SlinkyOracleIntegrationSuite) TestNodeFailures() { } func (s *SlinkyOracleIntegrationSuite) TestMultiplePriceFeeds() { - eth_usdc := constants.ETHEREUM_USDC - eth_usdt := constants.ETHEREUM_USDT - eth_usd := constants.ETHEREUM_USD + ethusdc := constants.ETHEREUM_USDC + ethusdt := constants.ETHEREUM_USDT + ethusd := constants.ETHEREUM_USD // add multiple currency pairs cps := []slinkytypes.CurrencyPair{ - eth_usdc.CurrencyPair, - eth_usdt.CurrencyPair, - eth_usd.CurrencyPair, + ethusdc, + ethusdt, + ethusd, } s.Require().NoError(s.AddCurrencyPairs(s.chain, s.authority.String(), s.denom, deposit, 2*s.blockTime, s.user, cps...)) @@ -474,13 +467,13 @@ func (s *SlinkyOracleIntegrationSuite) TestMultiplePriceFeeds() { // get the currency pair ids ctx := context.Background() - id1, err := getIDForCurrencyPair(ctx, oracletypes.NewQueryClient(cc), eth_usdc.CurrencyPair) + id1, err := getIDForCurrencyPair(ctx, oracletypes.NewQueryClient(cc), ethusdc) s.Require().NoError(err) - id2, err := getIDForCurrencyPair(ctx, oracletypes.NewQueryClient(cc), eth_usdt.CurrencyPair) + id2, err := getIDForCurrencyPair(ctx, oracletypes.NewQueryClient(cc), ethusdt) s.Require().NoError(err) - id3, err := getIDForCurrencyPair(ctx, oracletypes.NewQueryClient(cc), eth_usd.CurrencyPair) + id3, err := getIDForCurrencyPair(ctx, oracletypes.NewQueryClient(cc), ethusd) s.Require().NoError(err) zero := big.NewInt(0) @@ -506,60 +499,47 @@ func (s *SlinkyOracleIntegrationSuite) TestMultiplePriceFeeds() { }) marketConfig := mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - eth_usdc.String(): eth_usdc, - eth_usdt.String(): eth_usdt, - eth_usd.String(): eth_usd, - }, - Providers: map[string]mmtypes.Providers{ - eth_usdc.String(): { - Providers: []mmtypes.ProviderConfig{ + Markets: map[string]mmtypes.Market{ + ethusdc.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: ethusdc, + Decimals: 8, + MinProviderCount: 1, + }, ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: "1140", + OffChainTicker: ethusdc.String(), + Metadata_JSON: `{"price": 1.1}`, }, }, }, - eth_usdt.String(): { - Providers: []mmtypes.ProviderConfig{ + ethusdt.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: ethusdt, + Decimals: 8, + MinProviderCount: 1, + }, ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: "1141", + OffChainTicker: ethusdt.String(), + Metadata_JSON: `{"price": 1.1}`, }, }, }, - eth_usd.String(): { - Providers: []mmtypes.ProviderConfig{ + ethusd.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: ethusd, + Decimals: 8, + MinProviderCount: 1, + }, ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: "1142", + OffChainTicker: ethusd.String(), + Metadata_JSON: `{"price": 1.1}`, }, }, }, }, - Paths: map[string]mmtypes.Paths{ - eth_usdc.String(): {Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{{ - CurrencyPair: eth_usdc.CurrencyPair, - Invert: false, - Provider: static.Name, - }}}, - }}, - eth_usdt.String(): {Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{{ - CurrencyPair: eth_usdt.CurrencyPair, - Invert: false, - Provider: static.Name, - }}}, - }}, - eth_usd.String(): {Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{{ - CurrencyPair: eth_usd.CurrencyPair, - Invert: false, - Provider: static.Name, - }}}, - }}, - }, } oracle := GetOracleSideCar(node) @@ -601,10 +581,10 @@ func (s *SlinkyOracleIntegrationSuite) TestMultiplePriceFeeds() { s.Require().NoError(err) // query for the given currency pair - for i, cp := range cps { + for _, cp := range cps { resp, _, err := QueryCurrencyPair(s.chain, cp, height) s.Require().NoError(err) - s.Require().Equal(int64(1140+i), resp.Price.Int64()) + s.Require().Equal(int64(110000000), resp.Price.Int64()) } }) @@ -630,44 +610,34 @@ func (s *SlinkyOracleIntegrationSuite) TestMultiplePriceFeeds() { }) marketConfig := mmtypes.MarketMap{ - Tickers: map[string]mmtypes.Ticker{ - eth_usdc.String(): eth_usdc, - eth_usdt.String(): eth_usdt, - }, - Providers: map[string]mmtypes.Providers{ - eth_usdc.String(): { - Providers: []mmtypes.ProviderConfig{ + Markets: map[string]mmtypes.Market{ + ethusdc.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: ethusdc, + Decimals: 8, + MinProviderCount: 1, + }, ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: "1140", + OffChainTicker: ethusdc.String(), + Metadata_JSON: `{"price": 1.1}`, }, }, }, - eth_usdt.String(): { - Providers: []mmtypes.ProviderConfig{ + ethusdt.String(): { + Ticker: mmtypes.Ticker{ + CurrencyPair: ethusdt, + Decimals: 8, + MinProviderCount: 1, + }, ProviderConfigs: []mmtypes.ProviderConfig{ { Name: static.Name, - OffChainTicker: "1141", + OffChainTicker: ethusdt.String(), + Metadata_JSON: `{"price": 1.1}`, }, }, }, }, - Paths: map[string]mmtypes.Paths{ - eth_usdc.String(): {Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{{ - CurrencyPair: eth_usdc.CurrencyPair, - Invert: false, - Provider: static.Name, - }}}, - }}, - eth_usdt.String(): {Paths: []mmtypes.Path{ - {Operations: []mmtypes.Operation{{ - CurrencyPair: eth_usdt.CurrencyPair, - Invert: false, - Provider: static.Name, - }}}, - }}, - }, } oracle := GetOracleSideCar(node) diff --git a/tests/simapp/app.go b/tests/simapp/app.go index 09eee8159..679fb9fdf 100644 --- a/tests/simapp/app.go +++ b/tests/simapp/app.go @@ -23,7 +23,7 @@ import ( "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" - testdata_pulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" + testdatapulsar "github.com/cosmos/cosmos-sdk/testutil/testdata/testpb" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth" @@ -72,8 +72,8 @@ import ( alertskeeper "github.com/skip-mev/slinky/x/alerts/keeper" "github.com/skip-mev/slinky/x/incentives" incentiveskeeper "github.com/skip-mev/slinky/x/incentives/keeper" + marketmapmodule "github.com/skip-mev/slinky/x/marketmap" marketmapkeeper "github.com/skip-mev/slinky/x/marketmap/keeper" - marketmapmodule "github.com/skip-mev/slinky/x/marketmap/module" "github.com/skip-mev/slinky/x/oracle" oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper" ) @@ -410,7 +410,7 @@ func NewSimApp( // app.RegisterUpgradeHandlers() // add test gRPC service for testing gRPC queries in isolation - testdata_pulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdata_pulsar.QueryImpl{}) + testdatapulsar.RegisterQueryServer(app.GRPCQueryRouter(), testdatapulsar.QueryImpl{}) // create the simulation manager and define the order of the modules for deterministic simulations // diff --git a/tests/simapp/config.go b/tests/simapp/config.go index dfd826426..73efe9b49 100644 --- a/tests/simapp/config.go +++ b/tests/simapp/config.go @@ -3,8 +3,6 @@ package simapp import ( "time" - "google.golang.org/protobuf/types/known/durationpb" - runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" @@ -24,6 +22,7 @@ import ( upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" "cosmossdk.io/depinject" + "google.golang.org/protobuf/types/known/durationpb" alertmodulev1 "github.com/skip-mev/slinky/api/slinky/alerts/module/v1" incentivesmodulev1 "github.com/skip-mev/slinky/api/slinky/incentives/module/v1" @@ -45,9 +44,9 @@ import ( _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects - _ "github.com/skip-mev/slinky/x/incentives" // import for side-effects - _ "github.com/skip-mev/slinky/x/marketmap/module" // import for side-effects - _ "github.com/skip-mev/slinky/x/oracle" // import for side-effects + _ "github.com/skip-mev/slinky/x/incentives" // import for side-effects + _ "github.com/skip-mev/slinky/x/marketmap" // import for side-effects + _ "github.com/skip-mev/slinky/x/oracle" // import for side-effects "cosmossdk.io/core/appconfig" circuittypes "cosmossdk.io/x/circuit/types" diff --git a/x/marketmap/README.md b/x/marketmap/README.md deleted file mode 100644 index c46f40734..000000000 --- a/x/marketmap/README.md +++ /dev/null @@ -1,342 +0,0 @@ -# `x/marketmap` - -## Contents - -* [Concepts](#concepts) -* [Integration](#integtration) -* [State](#state) - * [MarketMap](#marketmap) - * [Params](#params) - * [MarketAuthority](#marketauthority) - * [Version](#version) -* [Events](#events) -* [Hooks](#hooks) - * [AfterMarketCreated](#aftermarketcreated) - * [AfterMarketUpdated](#aftermarketupdated) -* [Client](#client) - * [CLI](#cli) - * [gRPC](#grpc) - -## Concepts - -The `x/marketmap` module encapsulates a system for creating and updating a unified configuration that is stored on-chain -and consumed by a set of oracle service providers (Slinky oracle, etc.). - -The core goal of the system is to collect off-chain market updates and to post them on chain, informing oracle service -providers to fetch prices for new markets. - -The data is stored in a `MarketMap` data structure which can be queried and consumed by oracle services. - -## Integration - -When integrating `x/marketmap` into your Cosmos SDK application, some considerations must be made: - -### Module Hooks - -Integrating modules can use the [hooks](#hooks) exposed by `x/marketmap` to update their state whenever -changes are made to the marketmap. - -An example of this can be seen in `x/oracle`'s implementation of the `AfterMarketCreated` hook. This hook -triggers the creation of a `CurrencyPairState` that corresponds to the new `Ticker` that was created in the marketmap. -This allows for a unified flow where updates to the market map prepare the `x/oracle` module for new price feeds. - -### Genesis Order - -Any modules that integrate with `x/marketmap` must set their `InitGenesis` to occur _before_ the `x/marketmap` module's -`InitGenesis`. This is so that logic any consuming modules may want to implement in `AfterMarketGenesis` will be -run properly. - -## State - -### MarketMap - -The market map data is as follows: - -```protobuf -// Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price -// feed is scaled to a number of decimal places and has a minimum number of -// providers required to consider the ticker valid. -message Ticker { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - - // CurrencyPair is the currency pair for this ticker. - slinky.types.v1.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; - - // Decimals is the number of decimal places for the ticker. The number of - // decimal places is used to convert the price to a human-readable format. - uint64 decimals = 3; - // MinProviderCount is the minimum number of providers required to consider - // the ticker valid. - uint64 min_provider_count = 4; - - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given ticker. - string metadata_JSON = 15; -} - -message ProviderConfig { - // Name corresponds to the name of the provider for which the configuration is - // being set. - string name = 1; - - // OffChainTicker is the off-chain representation of the ticker i.e. BTC/USD. - // The off-chain ticker is unique to a given provider and is used to fetch the - // price of the ticker from the provider. - string off_chain_ticker = 2; -} - -// Path is the list of convertable markets that will be used to convert the -// prices of a set of tickers to a common ticker. -message Path { - // Operations is an ordered list of operations that will be taken. These must - // be topologically sorted to ensure that the conversion is possible i.e. DAG. - repeated Operation operations = 1 [ (gogoproto.nullable) = false ]; -} - -// Operation represents the operation configuration for a given ticker. -message Operation { - // CurrencyPair is the on-chain currency pair for this ticker. - slinky.types.v1.CurrencyPair currency_pair = 1 - [ (gogoproto.nullable) = false ]; - - // Invert is a boolean that indicates whether the price of the ticker should - // be inverted. - bool invert = 2; -} - -message Paths { - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - repeated Path paths = 1 [ (gogoproto.nullable) = false ]; -} - -message Providers { - // Providers is the list of provider configurations for the given ticker. - repeated ProviderConfig providers = 1 [ (gogoproto.nullable) = false ]; -} - -message MarketMap { - option (gogoproto.goproto_stringer) = false; - option (gogoproto.stringer) = false; - - // Tickers is the full list of tickers and their associated configurations - // to be stored on-chain. - map tickers = 1 [ (gogoproto.nullable) = false ]; - - // Paths is a map from CurrencyPair to all paths that resolve to that pair - map paths = 2 [ (gogoproto.nullable) = false ]; - - // Providers is a map from CurrencyPair to each of to provider-specific - // configs associated with it. - map providers = 3 [ (gogoproto.nullable) = false ]; -} -``` - -The `MarketMap` message itself is not stored in state. Rather, ticker strings are used as key prefixes -so that the data can be stored in a map-like structure, while retaining determinism. - -### Params - -The `x/marketmap` module stores its params in the keeper state. The params can be updated with governance or the -keeper authority address. - -The `x/marketmap` module contains the following parameters: - -| Key | Type | Example | -| MarketAuthority | string | "cosmos1vq93x443c0fznuf6...q4jd28ke6r46p999s0" | -| Version | uint64 | 20 | - -#### MarketAuthority - -The MarketAuthority is the bech32 address that is permitted to submit market updates to the chain. - -#### Version - -Version is the version of the MarketMap schema. This version is returned in the `GetMarketMap` query and can be used -by oracle service providers to verify the schema they are consuming. When being modified via governance, the new value -must always be greater than the current value. - -## Events - -The marketmap module emits the following events: - -### CreateMarket - -| Attribute Key | Attribute Value | -|--------------------|-----------------| -| currency_pair | {CurrencyPair} | -| decimals | {uint64} | -| min_provider_count | {uint64} | -| metadata | {json string} | -| providers | {[]Provider} | -| paths | {[]Path]} | - -## Hooks - -Other modules can register routines to execute after a certain event has occurred in `x/marketmap`. -The following hooks can be registered: - -### AfterMarketCreated - -* `AfterMarketCreated(ctx sdk.Context, ticker marketmaptypes.Ticker) error` - * Called after a new market is created in `CreateMarket` message server. - -### AfterMarketUpdated - -* `AfterMarketUpdated(ctx sdk.Context, ticker marketmaptypes.Ticker) error` - * Called after a new market is updated in `UpdateMarket` message server. - -### AfterMarketGenesis - -* `AfterMarketGenesis(ctx sdk.Context, tickers map[string]marketmaptypes.Ticker) error` - * Called at the end of `InitGenesis` for the `x/marketmap` keeper. - -## Client - -### gRPC - -A user can query the `marketmap` module using gRPC endpoints. - -#### MarketMap - -The `MarketMap` endpoint queries the full state of the market map as well as associated information such as -`LastUpdated` and `Version`. - -Example: - -```shell -grpcurl -plaintext localhost:9090 slinky.marketmap.v1.Query/MarketMap -``` - -Example response: - -```json -{ - "marketMap": { - "tickers": { - "BITCOIN/USD": { - "currencyPair": { - "Base": "BITCOIN", - "Quote": "USD" - }, - "decimals": "8", - "minProviderCount": "3" - } - }, - "paths": { - "BITCOIN/USD": { - "paths": [ - { - "operations": [ - { - "currencyPair": { - "Base": "BITCOIN", - "Quote": "USD" - } - } - ] - } - ] - } - }, - "providers": { - "BITCOIN/USD": { - "providers": [ - { - "name": "kucoin", - "offChainTicker": "btc_usd" - }, - { - "name": "mexc", - "offChainTicker": "btc-usd" - }, - { - "name": "binance", - "offChainTicker": "BTCUSD" - } - ] - } - } - }, - "lastUpdated": "1" -} -``` - -#### LastUpdated - -The `LastUpdated` endpoint queries the last block height that the market map was updated. -This can be consumed by oracle service providers to recognize when their local configurations -must be updated using the heavier `MarketMap` query. - -Example: - -```shell -grpcurl -plaintext localhost:9090 slinky.marketmap.v1.Query/LastUpdated -``` - -Example response: - -```json -{ - "lastUpdated": "1" -} -``` - -#### Params - -The params query allows users to query values set as marketmap parameters. - -Example: - -```shell -grpcurl -plaintext localhost:9090 slinky.marketmap.v1.Query/Params -``` - -Example response: - -```json -{ - "params": { - "marketAuthority": "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" - } -} -``` - -### CLI - -A user can query the `marketmap` module using the CLI. - -#### MarketMap - -The `MarketMap` endpoint queries the full state of the market map as well as associated information such as -`LastUpdated` and `Version`. - -Example: - -```shell - slinkyd q marketmap market-map -``` - -#### LastUpdated - -The `LastUpdated` query queries the last block height that the market map was updated. -This can be consumed by oracle service providers to recognize when their local configurations -must be updated using the heavier `MarketMap` query. - -Example: - -```shell - slinkyd q marketmap last-updated -``` - -#### Params - -The params query allows users to query values set as marketmap parameters. - -Example: - -```shell - slinkyd q marketmap params -``` diff --git a/x/marketmap/client/cli/query.go b/x/marketmap/client/cli/query.go index 46a1ca020..d4a9d27f2 100644 --- a/x/marketmap/client/cli/query.go +++ b/x/marketmap/client/cli/query.go @@ -5,10 +5,11 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/spf13/cobra" + slinkytypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/x/marketmap/types" ) -// GetQueryCmd returns the parent command for all x/alerts cli query commands. +// GetQueryCmd returns the parent command for all x/marketmap cli query commands. func GetQueryCmd() *cobra.Command { cmd := &cobra.Command{ Use: types.ModuleName, @@ -22,6 +23,7 @@ func GetQueryCmd() *cobra.Command { CmdQueryParams(), CmdQueryMarketMap(), CmdQueryLastUpdated(), + CmdQueryMarket(), ) return cmd @@ -65,7 +67,39 @@ func CmdQueryMarketMap() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.MarketMap(clientCtx.CmdContext, &types.GetMarketMapRequest{}) + res, err := queryClient.MarketMap(clientCtx.CmdContext, &types.MarketMapRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + return cmd +} + +func CmdQueryMarket() *cobra.Command { + cmd := &cobra.Command{ + Use: "market", + Short: "Query the a market using the given currency pair", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx, err := client.GetClientQueryContext(cmd) + if err != nil { + return err + } + + cp, err := slinkytypes.CurrencyPairFromString(args[0]) + if err != nil { + return err + } + + queryClient := types.NewQueryClient(clientCtx) + res, err := queryClient.Market(clientCtx.CmdContext, &types.MarketRequest{ + CurrencyPair: cp, + }) if err != nil { return err } @@ -90,7 +124,7 @@ func CmdQueryLastUpdated() *cobra.Command { } queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.LastUpdated(clientCtx.CmdContext, &types.GetLastUpdatedRequest{}) + res, err := queryClient.LastUpdated(clientCtx.CmdContext, &types.LastUpdatedRequest{}) if err != nil { return err } diff --git a/x/marketmap/keeper/genesis.go b/x/marketmap/keeper/genesis.go index f9fd608d1..630b7ded3 100644 --- a/x/marketmap/keeper/genesis.go +++ b/x/marketmap/keeper/genesis.go @@ -1,8 +1,6 @@ package keeper import ( - "fmt" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/skip-mev/slinky/x/marketmap/types" @@ -18,18 +16,8 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { panic(err) } - for _, ticker := range gs.MarketMap.Tickers { - paths, ok := gs.MarketMap.Paths[ticker.String()] - if !ok { - panic(fmt.Errorf("paths for ticker %s not found", ticker.String())) - } - - providers, ok := gs.MarketMap.Providers[ticker.String()] - if !ok { - panic(fmt.Errorf("providers for ticker %s not found", ticker.String())) - } - - if err := k.CreateMarket(ctx, ticker, paths, providers); err != nil { + for _, market := range gs.MarketMap.Markets { + if err := k.CreateMarket(ctx, market); err != nil { panic(err) } } @@ -42,39 +30,33 @@ func (k *Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { panic(err) } - if err := k.hooks.LegacyAfterMarketGenesis(ctx, gs.MarketMap.Tickers); err != nil { + if err := k.hooks.AfterMarketGenesis(ctx, gs.MarketMap.Markets); err != nil { panic(err) } } // ExportGenesis retrieves the genesis from state. func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - tickers, err := k.GetAllTickersMap(ctx) + markets, err := k.GetAllMarkets(ctx) if err != nil { panic(err) } - paths, err := k.GetAllPathsMap(ctx) - if err != nil { - panic(err) - } - - providers, err := k.GetAllProvidersMap(ctx) + lastUpdated, err := k.GetLastUpdated(ctx) if err != nil { panic(err) } - lastUpdated, err := k.GetLastUpdated(ctx) + params, err := k.GetParams(ctx) if err != nil { panic(err) } return &types.GenesisState{ MarketMap: types.MarketMap{ - Tickers: tickers, - Paths: paths, - Providers: providers, + Markets: markets, }, LastUpdated: lastUpdated, + Params: params, } } diff --git a/x/marketmap/keeper/genesis_test.go b/x/marketmap/keeper/genesis_test.go index 4147f1a36..6ff52c1d2 100644 --- a/x/marketmap/keeper/genesis_test.go +++ b/x/marketmap/keeper/genesis_test.go @@ -13,8 +13,7 @@ func (s *KeeperTestSuite) TestInitGenesisInvalidGenesis() { gs := types.GenesisState{ MarketMap: types.DefaultGenesisState().MarketMap, Params: types.Params{ - MarketAuthority: "invalid", - Version: 0, + MarketAuthorities: []string{"invalid"}, }, } @@ -29,20 +28,10 @@ func (s *KeeperTestSuite) TestInitGenesisInvalidGenesis() { gs := types.DefaultGenesisState() gs.MarketMap = types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, + Markets: map[string]types.Market{ + ethusdt.Ticker.String(): ethusdt, + btcusdt.Ticker.String(): btcusdt, + usdcusd.Ticker.String(): usdcusd, }, } @@ -54,38 +43,51 @@ func (s *KeeperTestSuite) TestInitGenesisInvalidGenesis() { }) } -func (s *KeeperTestSuite) TestInitGenesisValid() { - s.Run("init valid default genesis", func() { +func (s *KeeperTestSuite) TestInitExportGenesisValid() { + s.Run("init valid default genesis and export", func() { gs := types.DefaultGenesisState() s.Require().NotPanics(func() { s.keeper.InitGenesis(s.ctx, *gs) }) + + var gotState *types.GenesisState + s.Require().NotPanics(func() { + gotState = s.keeper.ExportGenesis(s.ctx) + }) + + s.Require().Equal(gs, gotState) }) s.Run("init valid genesis with fields", func() { // first register x/oracle genesis ogs := oracletypes.DefaultGenesisState() - ogs.NextId = 3 + ogs.NextId = 4 ogs.CurrencyPairGenesis = []oracletypes.CurrencyPairGenesis{ { - CurrencyPair: ethusdt.CurrencyPair, + CurrencyPair: ethusdt.Ticker.CurrencyPair, CurrencyPairPrice: &oracletypes.QuotePrice{Price: sdkmath.NewInt(19)}, Nonce: 0, Id: 0, }, { - CurrencyPair: btcusdt.CurrencyPair, + CurrencyPair: btcusdt.Ticker.CurrencyPair, CurrencyPairPrice: &oracletypes.QuotePrice{Price: sdkmath.NewInt(19)}, Nonce: 0, Id: 1, }, { - CurrencyPair: usdcusd.CurrencyPair, + CurrencyPair: usdcusd.Ticker.CurrencyPair, CurrencyPairPrice: nil, Nonce: 0, Id: 2, }, + { + CurrencyPair: usdtusd.Ticker.CurrencyPair, + CurrencyPairPrice: nil, + Nonce: 0, + Id: 3, + }, } s.Require().NotPanics(func() { @@ -94,37 +96,22 @@ func (s *KeeperTestSuite) TestInitGenesisValid() { gs := types.DefaultGenesisState() gs.MarketMap = types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, + Markets: marketsMap, } s.Require().NotPanics(func() { s.keeper.InitGenesis(s.ctx, *gs) }) - gotTickers, err := s.keeper.GetAllTickersMap(s.ctx) + gotMarkets, err := s.keeper.GetAllMarkets(s.ctx) s.Require().NoError(err) - s.Require().Equal(gs.MarketMap.Tickers, gotTickers) + s.Require().Equal(gs.MarketMap.Markets, gotMarkets) - gotPaths, err := s.keeper.GetAllPathsMap(s.ctx) - s.Require().NoError(err) - s.Require().Equal(gs.MarketMap.Paths, gotPaths) + var gotState *types.GenesisState + s.Require().NotPanics(func() { + gotState = s.keeper.ExportGenesis(s.ctx) + }) - gotProviders, err := s.keeper.GetAllProvidersMap(s.ctx) - s.Require().NoError(err) - s.Require().Equal(gs.MarketMap.Providers, gotProviders) + s.Require().Equal(gs, gotState) }) } diff --git a/x/marketmap/keeper/grpc_query.go b/x/marketmap/keeper/grpc_query.go deleted file mode 100644 index 8575c242a..000000000 --- a/x/marketmap/keeper/grpc_query.go +++ /dev/null @@ -1,96 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/marketmap/types" -) - -type queryServerImpl struct { - k *Keeper -} - -// NewQueryServer returns an implementation of the x/marketmap QueryServer. -func NewQueryServer(k *Keeper) types.QueryServer { - return &queryServerImpl{k} -} - -// MarketMap returns the full MarketMap and associated information stored in the x/marketmap module. -func (q queryServerImpl) MarketMap(goCtx context.Context, req *types.GetMarketMapRequest) (*types.GetMarketMapResponse, error) { - if req == nil { - return nil, fmt.Errorf("request cannot be nil") - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(goCtx) - - tickers, err := q.k.GetAllTickersMap(ctx) - if err != nil { - return nil, err - } - - paths, err := q.k.GetAllPathsMap(ctx) - if err != nil { - return nil, err - } - - providers, err := q.k.GetAllProvidersMap(ctx) - if err != nil { - return nil, err - } - - params, err := q.k.GetParams(ctx) - if err != nil { - return nil, err - } - - lastUpdated, err := q.k.GetLastUpdated(ctx) - return &types.GetMarketMapResponse{ - MarketMap: types.MarketMap{ - Tickers: tickers, - Paths: paths, - Providers: providers, - }, - LastUpdated: lastUpdated, - Version: params.Version, - ChainId: ctx.ChainID(), - }, - err -} - -// Params returns the parameters stored in the x/marketmap module. -func (q queryServerImpl) Params(goCtx context.Context, req *types.ParamsRequest) (*types.ParamsResponse, error) { - if req == nil { - return nil, fmt.Errorf("request cannot be nil") - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(goCtx) - - params, err := q.k.params.Get(ctx) - if err != nil { - return nil, err - } - - return &types.ParamsResponse{Params: params}, nil -} - -// LastUpdated returns the last height the marketmap was updated in the x/marketmap module. -func (q queryServerImpl) LastUpdated(goCtx context.Context, req *types.GetLastUpdatedRequest) (*types.GetLastUpdatedResponse, error) { - if req == nil { - return nil, fmt.Errorf("request cannot be nil") - } - - // unwrap the context - ctx := sdk.UnwrapSDKContext(goCtx) - - lastUpdated, err := q.k.lastUpdated.Get(ctx) - if err != nil { - return nil, err - } - - return &types.GetLastUpdatedResponse{LastUpdated: lastUpdated}, nil -} diff --git a/x/marketmap/keeper/grpc_query_test.go b/x/marketmap/keeper/grpc_query_test.go deleted file mode 100644 index 214cf25c1..000000000 --- a/x/marketmap/keeper/grpc_query_test.go +++ /dev/null @@ -1,107 +0,0 @@ -package keeper_test - -import ( - "github.com/skip-mev/slinky/x/marketmap/keeper" - "github.com/skip-mev/slinky/x/marketmap/types" -) - -func (s *KeeperTestSuite) TestMarketMap() { - qs := keeper.NewQueryServer(s.keeper) - s.ctx = s.ctx.WithChainID("test-chain") - - s.Run("invalid for nil request", func() { - _, err := qs.MarketMap(s.ctx, nil) - s.Require().Error(err) - }) - - s.Run("run query with no state", func() { - resp, err := qs.MarketMap(s.ctx, &types.GetMarketMapRequest{}) - s.Require().NoError(err) - - expected := &types.GetMarketMapResponse{ - MarketMap: types.MarketMap{ - Tickers: make(map[string]types.Ticker), - Paths: make(map[string]types.Paths), - Providers: make(map[string]types.Providers), - }, - LastUpdated: uint64(s.ctx.BlockHeight()), - Version: 10, - ChainId: "test-chain", - } - - s.Require().Equal(expected, resp) - }) - - s.Run("run query with state", func() { - expectedMarketMap := types.MarketMap{ - Tickers: make(map[string]types.Ticker), - Paths: make(map[string]types.Paths), - Providers: make(map[string]types.Providers), - } - for _, ticker := range markets.tickers { - marketPaths, ok := markets.paths[ticker.String()] - s.Require().True(ok) - marketProviders, ok := markets.providers[ticker.String()] - s.Require().True(ok) - s.Require().NoError(s.keeper.CreateMarket(s.ctx, ticker, marketPaths, marketProviders)) - expectedMarketMap.Tickers[ticker.String()] = ticker - expectedMarketMap.Paths[ticker.String()] = marketPaths - expectedMarketMap.Providers[ticker.String()] = marketProviders - } - - resp, err := qs.MarketMap(s.ctx, &types.GetMarketMapRequest{}) - s.Require().NoError(err) - - expected := &types.GetMarketMapResponse{ - MarketMap: expectedMarketMap, - LastUpdated: uint64(s.ctx.BlockHeight()), - ChainId: "test-chain", - } - - s.Require().Equal(expected.LastUpdated, resp.LastUpdated) - s.Require().Equal(expected.MarketMap, resp.MarketMap) - }) -} - -func (s *KeeperTestSuite) TestParams() { - params := types.DefaultParams() - s.Require().NoError(s.keeper.SetParams(s.ctx, params)) - - qs := keeper.NewQueryServer(s.keeper) - - s.Run("run valid request", func() { - resp, err := qs.Params(s.ctx, &types.ParamsRequest{}) - s.Require().NoError(err) - - s.Require().Equal(params, resp.Params) - }) - - s.Run("run invalid nil request", func() { - _, err := qs.Params(s.ctx, nil) - s.Require().Error(err) - }) -} - -func (s *KeeperTestSuite) TestLastUpdated() { - qs := keeper.NewQueryServer(s.keeper) - // set initial states - for _, ticker := range markets.tickers { - marketPaths, ok := markets.paths[ticker.String()] - s.Require().True(ok) - marketProviders, ok := markets.providers[ticker.String()] - s.Require().True(ok) - s.Require().NoError(s.keeper.CreateMarket(s.ctx, ticker, marketPaths, marketProviders)) - } - - s.Run("run valid request", func() { - resp, err := qs.LastUpdated(s.ctx, &types.GetLastUpdatedRequest{}) - s.Require().NoError(err) - - s.Require().Equal(uint64(s.ctx.BlockHeight()), resp.LastUpdated) - }) - - s.Run("run invalid nil request", func() { - _, err := qs.LastUpdated(s.ctx, nil) - s.Require().Error(err) - }) -} diff --git a/x/marketmap/keeper/keeper.go b/x/marketmap/keeper/keeper.go index 211f906c2..1da68b780 100644 --- a/x/marketmap/keeper/keeper.go +++ b/x/marketmap/keeper/keeper.go @@ -8,7 +8,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" - slinkytypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/x/marketmap/types" ) @@ -22,17 +21,9 @@ type Keeper struct { // registered hooks hooks types.MarketMapHooks - // tickers is keyed by CurrencyPair string (BASE/QUOTE) and contains - // the list of all Tickers. - tickers collections.Map[types.TickerString, types.Ticker] - - // paths is keyed by CurrencyPair string (BASE/QUOTE) and contains - // the list of all Paths. - paths collections.Map[types.TickerString, types.Paths] - - // providers is keyed by CurrencyPair string (BASE/QUOTE) and contains - // the list of all Providers. - providers collections.Map[types.TickerString, types.Providers] + // markets is keyed by CurrencyPair string (BASE/QUOTE) and contains + // the list of all Markets. + markets collections.Map[types.TickerString, types.Market] // lastUpdated is the last block height the marketmap was updated. lastUpdated collections.Item[uint64] @@ -56,9 +47,7 @@ func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.Acc return &Keeper{ cdc: cdc, authority: authority, - tickers: collections.NewMap(sb, types.TickersPrefix, "tickers", types.TickersCodec, codec.CollValue[types.Ticker](cdc)), - paths: collections.NewMap(sb, types.PathsPrefix, "paths", types.TickersCodec, codec.CollValue[types.Paths](cdc)), - providers: collections.NewMap(sb, types.ProvidersPrefix, "providers", types.TickersCodec, codec.CollValue[types.Providers](cdc)), + markets: collections.NewMap(sb, types.MarketsPrefix, "markets", types.TickersCodec, codec.CollValue[types.Market](cdc)), lastUpdated: collections.NewItem[uint64](sb, types.LastUpdatedPrefix, "last_updated", types.LastUpdatedCodec), params: params, } @@ -74,28 +63,15 @@ func (k *Keeper) GetLastUpdated(ctx sdk.Context) (uint64, error) { return k.lastUpdated.Get(ctx) } -// GetTicker returns a ticker from the store by its currency pair string ID. -func (k *Keeper) GetTicker(ctx sdk.Context, tickerStr string) (types.Ticker, error) { - return k.tickers.Get(ctx, types.TickerString(tickerStr)) -} - -// GetAllTickers returns the set of Ticker objects currently stored in state. -func (k *Keeper) GetAllTickers(ctx sdk.Context) ([]types.Ticker, error) { - iter, err := k.tickers.Iterate(ctx, nil) - if err != nil { - return nil, err - } - tickers, err := iter.Values() - if err != nil { - return nil, err - } - return tickers, err +// GetMarket returns a market from the store by its currency pair string ID. +func (k *Keeper) GetMarket(ctx sdk.Context, tickerStr string) (types.Market, error) { + return k.markets.Get(ctx, types.TickerString(tickerStr)) } -// GetAllTickersMap returns the set of Ticker objects currently stored in state -// as a map[TickerString] -> Tickers. -func (k *Keeper) GetAllTickersMap(ctx sdk.Context) (map[string]types.Ticker, error) { - iter, err := k.tickers.Iterate(ctx, nil) +// GetAllMarkets returns the set of Market objects currently stored in state +// as a map[TickerString] -> Markets. +func (k *Keeper) GetAllMarkets(ctx sdk.Context) (map[string]types.Market, error) { + iter, err := k.markets.Iterate(ctx, nil) if err != nil { return nil, err } @@ -104,7 +80,7 @@ func (k *Keeper) GetAllTickersMap(ctx sdk.Context) (map[string]types.Ticker, err return nil, err } - m := make(map[string]types.Ticker, len(keyValues)) + m := make(map[string]types.Market, len(keyValues)) for _, keyValue := range keyValues { m[string(keyValue.Key)] = keyValue.Value } @@ -112,109 +88,34 @@ func (k *Keeper) GetAllTickersMap(ctx sdk.Context) (map[string]types.Ticker, err return m, nil } -// CreateTicker initializes a new Ticker. +// CreateMarket initializes a new Market. // The Ticker.String corresponds to a market, and must be unique. -func (k *Keeper) CreateTicker(ctx sdk.Context, ticker types.Ticker) error { - tickerString := types.TickerString(ticker.String()) - +func (k *Keeper) CreateMarket(ctx sdk.Context, market types.Market) error { // Check if Ticker already exists for the provider - alreadyExists, err := k.tickers.Has(ctx, tickerString) - if err != nil { - return err - } - if alreadyExists { - return types.NewTickerAlreadyExistsError(tickerString) - } - // Create the config - return k.tickers.Set(ctx, tickerString, ticker) -} - -// GetAllProvidersMap returns the set of Providers objects currently stored in state -// as a map[TickerString] -> Providers. -func (k *Keeper) GetAllProvidersMap(ctx sdk.Context) (map[string]types.Providers, error) { - iter, err := k.providers.Iterate(ctx, nil) - if err != nil { - return nil, err - } - keyValues, err := iter.KeyValues() - if err != nil { - return nil, err - } - - m := make(map[string]types.Providers, len(keyValues)) - for _, keyValue := range keyValues { - m[string(keyValue.Key)] = keyValue.Value - } - - return m, nil -} - -// CreateProviders initializes a new providers. -// The Ticker.String corresponds to a market, and must be unique. -func (k *Keeper) CreateProviders(ctx sdk.Context, providers types.Providers, ticker types.Ticker) error { - // Check if MarketConfig already exists for the provider - alreadyExists, err := k.providers.Has(ctx, types.TickerString(ticker.String())) + alreadyExists, err := k.markets.Has(ctx, types.TickerString(market.Ticker.String())) if err != nil { return err } if alreadyExists { - return types.NewTickerAlreadyExistsError(types.TickerString(ticker.String())) + return types.NewMarketAlreadyExistsError(types.TickerString(market.Ticker.String())) } // Create the config - return k.providers.Set(ctx, types.TickerString(ticker.String()), providers) + return k.markets.Set(ctx, types.TickerString(market.Ticker.String()), market) } -// GetAllPathsMap returns the set of Paths objects currently stored in state -// as a map[TickerString] -> Paths. -func (k *Keeper) GetAllPathsMap(ctx sdk.Context) (map[string]types.Paths, error) { - iter, err := k.paths.Iterate(ctx, nil) - if err != nil { - return nil, err - } - keyValues, err := iter.KeyValues() - if err != nil { - return nil, err - } - - m := make(map[string]types.Paths, len(keyValues)) - for _, keyValue := range keyValues { - m[string(keyValue.Key)] = keyValue.Value - } - - return m, nil -} - -// CreatePaths initializes a new Paths. -// The Ticker.String corresponds to a market, and must be unique. -func (k *Keeper) CreatePaths(ctx sdk.Context, paths types.Paths, ticker types.Ticker) error { - // Check if MarketConfig already exists for the provider - alreadyExists, err := k.paths.Has(ctx, types.TickerString(ticker.String())) +// UpdateMarket updates a Market. +// The Ticker.String corresponds to a market, and exist unique. +func (k *Keeper) UpdateMarket(ctx sdk.Context, market types.Market) error { + // Check if Ticker already exists for the provider + alreadyExists, err := k.markets.Has(ctx, types.TickerString(market.Ticker.String())) if err != nil { return err } - if alreadyExists { - return types.NewTickerAlreadyExistsError(types.TickerString(ticker.String())) + if !alreadyExists { + return types.NewMarketDoesNotExistsError(types.TickerString(market.Ticker.String())) } // Create the config - return k.paths.Set(ctx, types.TickerString(ticker.String()), paths) -} - -// CreateMarket sets the ticker, paths, and providers for a given market. It also -// sets the LastUpdated field to the current block height. -func (k *Keeper) CreateMarket(ctx sdk.Context, ticker types.Ticker, paths types.Paths, providers types.Providers) error { - if err := k.CreateTicker(ctx, ticker); err != nil { - return err - } - - if err := k.CreatePaths(ctx, paths, ticker); err != nil { - return err - } - - if err := k.CreateProviders(ctx, providers, ticker); err != nil { - return err - } - - return k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) + return k.markets.Set(ctx, types.TickerString(market.Ticker.String()), market) } // SetParams sets the x/marketmap module's parameters. @@ -229,29 +130,32 @@ func (k *Keeper) GetParams(ctx sdk.Context) (types.Params, error) { // ValidateState is called after keeper modifications have been made to the market map to verify that // the aggregate of all updates has led to a valid state. -func (k *Keeper) ValidateState(ctx sdk.Context, creates []types.CreateMarket) error { - for _, create := range creates { - // check that all paths already exist in the keeper store: - for _, path := range create.Paths.Paths { - for _, op := range path.Operations { - cp := op.CurrencyPair - if op.Invert { - cp = slinkytypes.CurrencyPair{ - Base: cp.Quote, - Quote: cp.Base, - } - } +func (k *Keeper) ValidateState(ctx sdk.Context, updates []types.Market) error { + for _, market := range updates { + if err := k.IsMarketValid(ctx, market); err != nil { + return err + } + } + + return nil +} - has, err := k.tickers.Has(ctx, types.TickerString(cp.String())) - if err != nil { - return err - } +// IsMarketValid checks if a market is valid by statefully checking if each of the currency pairs +// specified by its provider configs are valid and in state. +func (k *Keeper) IsMarketValid(ctx sdk.Context, market types.Market) error { + // check that all markets already exist in the keeper store: + for _, providerConfig := range market.ProviderConfigs { + if providerConfig.NormalizeByPair != nil { + has, err := k.markets.Has(ctx, types.TickerString(providerConfig.NormalizeByPair.String())) + if err != nil { + return err + } - if !has { - return fmt.Errorf("currency pair %s in path %s does not exist", cp.String(), path.ShowRoute()) - } + if !has { + return fmt.Errorf("currency pair %s in provider config does not exist", providerConfig.NormalizeByPair.String()) } } } + return nil } diff --git a/x/marketmap/keeper/keeper_test.go b/x/marketmap/keeper/keeper_test.go index 5d6234664..3731d849b 100644 --- a/x/marketmap/keeper/keeper_test.go +++ b/x/marketmap/keeper/keeper_test.go @@ -3,6 +3,11 @@ package keeper_test import ( "testing" + "github.com/skip-mev/chaintestutil/sample" + + oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper" + oracletypes "github.com/skip-mev/slinky/x/oracle/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/runtime" "github.com/cosmos/cosmos-sdk/testutil" @@ -13,21 +18,22 @@ import ( slinkytypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/x/marketmap/keeper" "github.com/skip-mev/slinky/x/marketmap/types" - oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper" - oracletypes "github.com/skip-mev/slinky/x/oracle/types" ) +var r = sample.Rand() + type KeeperTestSuite struct { suite.Suite ctx sdk.Context // Keeper variables - authority sdk.AccAddress + authority sdk.AccAddress + marketAuthorities []string + admin string + keeper *keeper.Keeper oracleKeeper oraclekeeper.Keeper - - hooks types.MarketMapHooks } func (s *KeeperTestSuite) initKeeper() *keeper.Keeper { @@ -53,17 +59,24 @@ func (s *KeeperTestSuite) initKeeper() *keeper.Keeper { k := keeper.NewKeeper(mmSS, encCfg.Codec, s.authority) s.Require().NoError(k.SetLastUpdated(s.ctx, uint64(s.ctx.BlockHeight()))) - params := types.NewParams(s.authority.String(), 10) + s.admin = sample.Address(r) + s.marketAuthorities = []string{sample.Address(r), sample.Address(r), sample.Address(r)} + + params := types.Params{ + MarketAuthorities: s.marketAuthorities, + Admin: s.admin, + } s.Require().NoError(k.SetParams(s.ctx, params)) - s.oracleKeeper = oraclekeeper.NewKeeper(oracleSS, encCfg.Codec, nil, s.authority) - s.hooks = types.MultiMarketMapHooks{ + s.oracleKeeper = oraclekeeper.NewKeeper(oracleSS, encCfg.Codec, k, s.authority) + hooks := types.MultiMarketMapHooks{ s.oracleKeeper.Hooks(), } + k.SetHooks(hooks) - oracleGenesis := oracletypes.DefaultGenesisState() - s.Require().NotPanics(func() { s.oracleKeeper.InitGenesis(s.ctx, *oracleGenesis) }) - k.SetHooks(s.hooks) + s.Require().NotPanics(func() { + s.oracleKeeper.InitGenesis(s.ctx, *oracletypes.DefaultGenesisState()) + }) return k } @@ -77,33 +90,16 @@ func TestKeeperTestSuite(t *testing.T) { } var ( - btcusdt = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - } - - btcusdtPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - }, - }, + btcusdt = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "BITCOIN", + Quote: "USDT", }, + Decimals: 8, + MinProviderCount: 1, }, - } - - btcusdtProviders = types.Providers{ - Providers: []types.ProviderConfig{ + ProviderConfigs: []types.ProviderConfig{ { Name: "kucoin", OffChainTicker: "btc-usdt", @@ -111,33 +107,16 @@ var ( }, } - usdtusd = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - } - - usdtusdPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "USD", - }, - }, - }, + usdtusd = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", }, + Decimals: 8, + MinProviderCount: 1, }, - } - - usdtusdProviders = types.Providers{ - Providers: []types.ProviderConfig{ + ProviderConfigs: []types.ProviderConfig{ { Name: "kucoin", OffChainTicker: "usdt-usd", @@ -145,33 +124,16 @@ var ( }, } - usdcusd = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDC", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - } - - usdcusdPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDC", - Quote: "USD", - }, - }, - }, + usdcusd = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "USDC", + Quote: "USD", }, + Decimals: 8, + MinProviderCount: 1, }, - } - - usdcusdProviders = types.Providers{ - Providers: []types.ProviderConfig{ + ProviderConfigs: []types.ProviderConfig{ { Name: "kucoin", OffChainTicker: "usdc-usd", @@ -179,33 +141,16 @@ var ( }, } - ethusdt = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - } - - ethusdtPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - }, - }, + ethusdt = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "ETHEREUM", + Quote: "USDT", }, + Decimals: 8, + MinProviderCount: 1, }, - } - - ethusdtProviders = types.Providers{ - Providers: []types.ProviderConfig{ + ProviderConfigs: []types.ProviderConfig{ { Name: "kucoin", OffChainTicker: "eth-usdt", @@ -213,83 +158,48 @@ var ( }, } - tickers = map[string]types.Ticker{ - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - usdtusd.String(): usdtusd, - ethusdt.String(): ethusdt, + markets = []types.Market{ + btcusdt, + usdcusd, + usdtusd, + ethusdt, } - paths = map[string]types.Paths{ - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - usdtusd.String(): usdtusdPaths, - ethusdt.String(): ethusdtPaths, - } - - providers = map[string]types.Providers{ - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - usdtusd.String(): usdtusdProviders, - ethusdt.String(): ethusdtProviders, - } - - markets = struct { - tickers map[string]types.Ticker - paths map[string]types.Paths - providers map[string]types.Providers - }{ - tickers: tickers, - paths: paths, - providers: providers, + marketsMap = map[string]types.Market{ + btcusdt.Ticker.String(): btcusdt, + usdcusd.Ticker.String(): usdcusd, + usdtusd.Ticker.String(): usdtusd, + ethusdt.Ticker.String(): ethusdt, } ) func (s *KeeperTestSuite) TestGets() { - s.Run("get no tickers", func() { - got, err := s.keeper.GetAllTickers(s.ctx) + s.Run("get empty market map", func() { + got, err := s.keeper.GetAllMarkets(s.ctx) s.Require().NoError(err) - s.Require().Equal([]types.Ticker(nil), got) + s.Require().Equal(map[string]types.Market{}, got) }) s.Run("setup initial markets", func() { - for _, ticker := range markets.tickers { - marketPaths, ok := markets.paths[ticker.String()] - s.Require().True(ok) - marketProviders, ok := markets.providers[ticker.String()] - s.Require().True(ok) - s.Require().NoError(s.keeper.CreateMarket(s.ctx, ticker, marketPaths, marketProviders)) + for _, market := range markets { + s.Require().NoError(s.keeper.CreateMarket(s.ctx, market)) } s.Run("unable to set markets again", func() { - for _, ticker := range markets.tickers { - s.Require().ErrorIs(s.keeper.CreateTicker(s.ctx, ticker), types.NewTickerAlreadyExistsError(types.TickerString(ticker.String()))) + for _, market := range markets { + s.Require().ErrorIs(s.keeper.CreateMarket(s.ctx, market), types.NewMarketAlreadyExistsError(types.TickerString(market.Ticker.String()))) } }) - }) - s.Run("get all tickers", func() { - got, err := s.keeper.GetAllTickersMap(s.ctx) - s.Require().NoError(err) - - s.Require().Equal(len(tickers), len(got)) - s.Require().Equal(tickers, got) - }) - - s.Run("get all paths", func() { - got, err := s.keeper.GetAllPathsMap(s.ctx) - s.Require().NoError(err) - - s.Require().Equal(len(paths), len(got)) - s.Require().Equal(paths, got) + s.Require().NoError(s.keeper.ValidateState(s.ctx, markets)) }) - s.Run("get all providers", func() { - got, err := s.keeper.GetAllProvidersMap(s.ctx) + s.Run("get all tickers", func() { + got, err := s.keeper.GetAllMarkets(s.ctx) s.Require().NoError(err) - s.Require().Equal(len(providers), len(got)) - s.Require().Equal(providers, got) + s.Require().Equal(len(markets), len(got)) + s.Require().Equal(marketsMap, got) }) } @@ -305,3 +215,60 @@ func (s *KeeperTestSuite) TestSetParams() { s.Require().Equal(params, params2) }) } + +func (s *KeeperTestSuite) TestInvalidCreate() { + // invalid market with a normalize pair not in state + invalidMarket := types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "BITCOIN", + Quote: "USDT", + }, + Decimals: 8, + MinProviderCount: 1, + }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-usdt", + NormalizeByPair: &slinkytypes.CurrencyPair{Base: "invalid", Quote: "pair"}, + }, + }, + } + + s.Require().NoError(s.keeper.CreateMarket(s.ctx, invalidMarket)) + s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) +} + +func (s *KeeperTestSuite) TestInvalidUpdate() { + // create a valid market + s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) + + // invalid market with a normalize pair not in state + invalidMarket := btcusdt + invalidMarket.ProviderConfigs = append(invalidMarket.ProviderConfigs, types.ProviderConfig{ + Name: "huobi", + OffChainTicker: "btc-usdt", + NormalizeByPair: &slinkytypes.CurrencyPair{Base: "invalid", Quote: "pair"}, + }) + + s.Require().NoError(s.keeper.UpdateMarket(s.ctx, invalidMarket)) + s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) +} + +func (s *KeeperTestSuite) TestValidUpdate() { + // create a valid markets + s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) + s.Require().NoError(s.keeper.CreateMarket(s.ctx, ethusdt)) + + // valid market with a normalize pair that is in state + validMarket := btcusdt + validMarket.ProviderConfigs = append(validMarket.ProviderConfigs, types.ProviderConfig{ + Name: "huobi", + OffChainTicker: "btc-usdt", + NormalizeByPair: ðusdt.Ticker.CurrencyPair, + }) + + s.Require().NoError(s.keeper.UpdateMarket(s.ctx, validMarket)) + s.Require().NoError(s.keeper.ValidateState(s.ctx, []types.Market{validMarket})) +} diff --git a/x/marketmap/keeper/msg_server.go b/x/marketmap/keeper/msg_server.go index 65c36b0b6..e3b933d1d 100644 --- a/x/marketmap/keeper/msg_server.go +++ b/x/marketmap/keeper/msg_server.go @@ -3,6 +3,7 @@ package keeper import ( "context" "fmt" + "slices" "strconv" sdk "github.com/cosmos/cosmos-sdk/types" @@ -22,9 +23,9 @@ func NewMsgServer(k *Keeper) types.MsgServer { var _ types.MsgServer = (*msgServer)(nil) -// UpdateMarketMap updates the marketmap from the given message. All updates are made to the market map and then -// the resulting final state is checked to verify that the end state is valid. -func (ms msgServer) UpdateMarketMap(goCtx context.Context, msg *types.MsgUpdateMarketMap) (*types.MsgUpdateMarketMapResponse, error) { +// CreateMarkets updates the marketmap by creating markets from the given message. All updates are made to the market +// map and then the resulting final state is checked to verify that the end state is valid. +func (ms msgServer) CreateMarkets(goCtx context.Context, msg *types.MsgCreateMarkets) (*types.MsgCreateMarketsResponse, error) { if msg == nil { return nil, fmt.Errorf("unable to process nil msg") } @@ -36,20 +37,21 @@ func (ms msgServer) UpdateMarketMap(goCtx context.Context, msg *types.MsgUpdateM return nil, fmt.Errorf("unable to get marketmap params: %w", err) } - if msg.Signer != params.MarketAuthority { - return nil, fmt.Errorf("request signer %s does not match module market authority %s", msg.Signer, params.MarketAuthority) + found := checkMarketAuthority(msg.Authority, params) + if !found { + return nil, fmt.Errorf("request signer %s does not match module market authorities", msg.Authority) } // create markets for _, market := range msg.CreateMarkets { - err = ms.k.CreateMarket(ctx, market.Ticker, market.Paths, market.Providers) + err = ms.k.CreateMarket(ctx, market) if err != nil { return nil, err } - err = ms.k.hooks.LegacyAfterMarketCreated(ctx, market.Ticker) + err = ms.k.hooks.AfterMarketCreated(ctx, market) if err != nil { - return nil, fmt.Errorf("unable to handle hook for ticker %s: %w", market.Ticker.String(), err) + return nil, fmt.Errorf("unable to run create market hook: %w", err) } event := sdk.NewEvent( @@ -58,22 +60,67 @@ func (ms msgServer) UpdateMarketMap(goCtx context.Context, msg *types.MsgUpdateM sdk.NewAttribute(types.AttributeKeyDecimals, strconv.FormatUint(market.Ticker.Decimals, 10)), sdk.NewAttribute(types.AttributeKeyMinProviderCount, strconv.FormatUint(market.Ticker.MinProviderCount, 10)), sdk.NewAttribute(types.AttributeKeyMetadata, market.Ticker.Metadata_JSON), - sdk.NewAttribute(types.AttributeKeyProviders, market.Providers.String()), - sdk.NewAttribute(types.AttributeKeyPaths, market.Paths.String()), ) ctx.EventManager().EmitEvent(event) } - // update markets - // TODO - // validate that the new state of the marketmap is valid err = ms.k.ValidateState(ctx, msg.CreateMarkets) if err != nil { return nil, fmt.Errorf("invalid state resulting from update: %w", err) } - return &types.MsgUpdateMarketMapResponse{}, nil + return &types.MsgCreateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) +} + +// UpdateMarkets updates the marketmap by updating markets from the given message. All updates are made to the market +// map and then the resulting final state is checked to verify that the end state is valid. +func (ms msgServer) UpdateMarkets(goCtx context.Context, msg *types.MsgUpdateMarkets) (*types.MsgUpdateMarketsResponse, error) { + if msg == nil { + return nil, fmt.Errorf("unable to process nil msg") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + + params, err := ms.k.GetParams(ctx) + if err != nil { + return nil, fmt.Errorf("unable to get marketmap params: %w", err) + } + + found := checkMarketAuthority(msg.Authority, params) + if !found { + return nil, fmt.Errorf("request signer %s does not match module market authorities", msg.Authority) + } + + for _, market := range msg.UpdateMarkets { + err = ms.k.UpdateMarket(ctx, market) + if err != nil { + return nil, fmt.Errorf("unable to update market: %w", err) + } + + err = ms.k.hooks.AfterMarketUpdated(ctx, market) + if err != nil { + return nil, fmt.Errorf("unable to run update market hook: %w", err) + } + + event := sdk.NewEvent( + types.EventTypeUpdateMarket, + sdk.NewAttribute(types.AttributeKeyCurrencyPair, market.Ticker.String()), + sdk.NewAttribute(types.AttributeKeyDecimals, strconv.FormatUint(market.Ticker.Decimals, 10)), + sdk.NewAttribute(types.AttributeKeyMinProviderCount, strconv.FormatUint(market.Ticker.MinProviderCount, 10)), + sdk.NewAttribute(types.AttributeKeyMetadata, market.Ticker.Metadata_JSON), + ) + ctx.EventManager().EmitEvent(event) + + } + + // validate that the new state of the marketmap is valid + err = ms.k.ValidateState(ctx, msg.UpdateMarkets) + if err != nil { + return nil, fmt.Errorf("invalid state resulting from update: %w", err) + } + + return &types.MsgUpdateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) } // Params updates the x/marketmap module's Params. @@ -82,24 +129,68 @@ func (ms msgServer) Params(goCtx context.Context, msg *types.MsgParams) (*types. return nil, fmt.Errorf("unable to process nil msg") } - // Update the module's parameters. ctx := sdk.UnwrapSDKContext(goCtx) + + if msg.Authority != ms.k.authority.String() { + return nil, fmt.Errorf("request authority %s does not match module keeper authority %s", msg.Authority, ms.k.authority.String()) + } + + if err := ms.k.SetParams(ctx, msg.Params); err != nil { + return nil, err + } + + return &types.MsgParamsResponse{}, nil +} + +func (ms msgServer) RemoveMarketAuthorities(goCtx context.Context, msg *types.MsgRemoveMarketAuthorities) (*types.MsgRemoveMarketAuthoritiesResponse, error) { + if msg == nil { + return nil, fmt.Errorf("unable to process nil msg") + } + + ctx := sdk.UnwrapSDKContext(goCtx) + params, err := ms.k.GetParams(ctx) if err != nil { return nil, err } - if msg.Authority != ms.k.authority.String() { - return nil, fmt.Errorf("request authority %s does not match module keeper authority %s", msg.Authority, ms.k.authority.String()) + if msg.Admin != params.Admin { + return nil, fmt.Errorf("request admin %s does not match module admin %s", msg.Admin, params.Admin) } - if msg.Params.Version < params.Version { - return nil, fmt.Errorf("request version %d is less than current params version %d", msg.Params.Version, params.Version) + if len(msg.RemoveAddresses) > len(params.MarketAuthorities) { + return nil, fmt.Errorf("remove addresses must be a subset of the current market authorities") } - if err := ms.k.SetParams(ctx, msg.Params); err != nil { + removeAddresses := make(map[string]struct{}, len(msg.RemoveAddresses)) + for _, remove := range msg.RemoveAddresses { + removeAddresses[remove] = struct{}{} + } + + for i, address := range params.MarketAuthorities { + if _, found := removeAddresses[address]; found { + params.MarketAuthorities = slices.Delete(params.MarketAuthorities, i, i+1) + } + } + + if err := ms.k.SetParams(ctx, params); err != nil { return nil, err } - return &types.MsgParamsResponse{}, nil + return &types.MsgRemoveMarketAuthoritiesResponse{}, nil +} + +// checkMarketAuthority checks if the given authority is the x/marketmap's list of MarketAuthorities. +func checkMarketAuthority(authority string, params types.Params) bool { + if len(params.MarketAuthorities) == 0 { + return false + } + + for _, auth := range params.MarketAuthorities { + if authority == auth { + return true + } + } + + return false } diff --git a/x/marketmap/keeper/msg_server_test.go b/x/marketmap/keeper/msg_server_test.go index 302ee8ab2..7acdb6414 100644 --- a/x/marketmap/keeper/msg_server_test.go +++ b/x/marketmap/keeper/msg_server_test.go @@ -1,120 +1,205 @@ package keeper_test import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/skip-mev/chaintestutil/sample" + slinkytypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/x/marketmap/keeper" "github.com/skip-mev/slinky/x/marketmap/types" ) -func (s *KeeperTestSuite) TestMsgServerCreateMarket() { +func (s *KeeperTestSuite) TestMsgServerCreateMarkets() { msgServer := keeper.NewMsgServer(s.keeper) - qs := keeper.NewQueryServer(s.keeper) // create initial markets - msg := &types.MsgUpdateMarketMap{ - Signer: s.authority.String(), - CreateMarkets: []types.CreateMarket{ - { - Ticker: btcusdt, - Providers: btcusdtProviders, - Paths: btcusdtPaths, - }, - { - Ticker: usdtusd, - Providers: usdtusdProviders, - Paths: usdtusdPaths, - }, + msg := &types.MsgCreateMarkets{ + Authority: s.marketAuthorities[1], + CreateMarkets: []types.Market{ + btcusdt, + usdtusd, }, } - resp, err := msgServer.UpdateMarketMap(s.ctx, msg) + resp, err := msgServer.CreateMarkets(s.ctx, msg) s.Require().NoError(err) s.Require().NotNil(resp) // query the market map - queryResp, err := qs.MarketMap(s.ctx, &types.GetMarketMapRequest{}) + mm, err := s.keeper.GetAllMarkets(s.ctx) s.Require().NoError(err) - s.Require().Equal(queryResp.MarketMap, types.MarketMap{ - Tickers: map[string]types.Ticker{ - btcusdt.String(): btcusdt, - usdtusd.String(): usdtusd, - }, - Paths: map[string]types.Paths{ - btcusdt.String(): btcusdtPaths, - usdtusd.String(): usdtusdPaths, - }, - Providers: map[string]types.Providers{ - btcusdt.String(): btcusdtProviders, - usdtusd.String(): usdtusdProviders, + s.Require().Equal(types.MarketMap{Markets: mm}, types.MarketMap{ + Markets: map[string]types.Market{ + btcusdt.Ticker.String(): btcusdt, + usdtusd.Ticker.String(): usdtusd, }, }) // query the oracle module to see if they were created via hooks cps := s.oracleKeeper.GetAllCurrencyPairs(s.ctx) - s.Require().Equal([]slinkytypes.CurrencyPair{btcusdt.CurrencyPair, usdtusd.CurrencyPair}, cps) + s.Require().Equal([]slinkytypes.CurrencyPair{btcusdt.Ticker.CurrencyPair, usdtusd.Ticker.CurrencyPair}, cps) s.Run("unable to process for invalid authority", func() { - msg = &types.MsgUpdateMarketMap{ - Signer: "invalid", + msg = &types.MsgCreateMarkets{ + Authority: "invalid", } - resp, err = msgServer.UpdateMarketMap(s.ctx, msg) + resp, err = msgServer.CreateMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("unable to process for invalid authority (valid bech32)", func() { + msg = &types.MsgCreateMarkets{ + Authority: sdk.AccAddress("invalid").String(), + } + resp, err = msgServer.CreateMarkets(s.ctx, msg) s.Require().Error(err) s.Require().Nil(resp) }) // set a market in the map s.Run("unable to process nil request", func() { - resp, err = msgServer.UpdateMarketMap(s.ctx, nil) + resp, err = msgServer.CreateMarkets(s.ctx, nil) s.Require().Error(err) s.Require().Nil(resp) }) s.Run("unable to create market that already exists", func() { - msg = &types.MsgUpdateMarketMap{ - Signer: s.authority.String(), - CreateMarkets: []types.CreateMarket{ - { - Ticker: btcusdt, - Providers: btcusdtProviders, - Paths: btcusdtPaths, - }, + msg = &types.MsgCreateMarkets{ + Authority: s.authority.String(), + CreateMarkets: []types.Market{ + btcusdt, }, } - resp, err = msgServer.UpdateMarketMap(s.ctx, msg) + resp, err = msgServer.CreateMarkets(s.ctx, msg) s.Require().Error(err) s.Require().Nil(resp) }) - s.Run("unable to create market with paths that are not on chain tickers", func() { - msg = &types.MsgUpdateMarketMap{ - Signer: s.authority.String(), - CreateMarkets: []types.CreateMarket{ + s.Run("unable to create market with normalize by that is not on chain tickers", func() { + msg = &types.MsgCreateMarkets{ + Authority: s.authority.String(), + CreateMarkets: []types.Market{ { - Ticker: ethusdt, - Providers: ethusdtProviders, - Paths: types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "MOG", - }, - }, - { - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "MOG", - Quote: "USDT", - }, - }, - }, + Ticker: ethusdt.Ticker, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "eth-usdt", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "INVALID", + Quote: "PAIR", }, }, }, }, }, } - resp, err = msgServer.UpdateMarketMap(s.ctx, msg) + resp, err = msgServer.CreateMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) +} + +func (s *KeeperTestSuite) TestMsgServerUpdateMarkets() { + msgServer := keeper.NewMsgServer(s.keeper) + + // create initial markets + createMsg := &types.MsgCreateMarkets{ + Authority: s.marketAuthorities[0], + CreateMarkets: []types.Market{ + btcusdt, + usdtusd, + }, + } + createResp, err := msgServer.CreateMarkets(s.ctx, createMsg) + s.Require().NoError(err) + s.Require().NotNil(createResp) + + // query the market map + mm, err := s.keeper.GetAllMarkets(s.ctx) + s.Require().NoError(err) + s.Require().Equal(types.MarketMap{Markets: mm}, types.MarketMap{ + Markets: map[string]types.Market{ + btcusdt.Ticker.String(): btcusdt, + usdtusd.Ticker.String(): usdtusd, + }, + }) + + // TODO: test hooks + + s.Run("unable to process for invalid authority", func() { + msg := &types.MsgUpdateMarkets{ + Authority: "invalid", + } + resp, err := msgServer.UpdateMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("unable to process for invalid authority (valid bech32)", func() { + msg := &types.MsgUpdateMarkets{ + Authority: sdk.AccAddress("invalid").String(), + } + resp, err := msgServer.UpdateMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + // set a market in the map + s.Run("unable to process nil request", func() { + resp, err := msgServer.UpdateMarkets(s.ctx, nil) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("able to update market that already exists", func() { + tickerUpdate := btcusdt + tickerUpdate.Ticker.Decimals = 1 + + msg := &types.MsgUpdateMarkets{ + Authority: s.marketAuthorities[2], + UpdateMarkets: []types.Market{ + tickerUpdate, + }, + } + resp, err := msgServer.UpdateMarkets(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + }) + + s.Run("unable to update when paths refers to non-existent ticker", func() { + tickerUpdate := btcusdt + tickerUpdate.Ticker.Decimals = 1 + tickerUpdate.ProviderConfigs = []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-usdc", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "INVALID", + Quote: "PAIR", + }, + }, + } + + msg := &types.MsgUpdateMarkets{ + Authority: s.authority.String(), + UpdateMarkets: []types.Market{ + tickerUpdate, + }, + } + resp, err := msgServer.UpdateMarkets(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("unable to update market if it does not already exist", func() { + msg := &types.MsgUpdateMarkets{ + Authority: s.authority.String(), + UpdateMarkets: []types.Market{ + ethusdt, + }, + } + resp, err := msgServer.UpdateMarkets(s.ctx, msg) s.Require().Error(err) s.Require().Nil(resp) }) @@ -138,42 +223,106 @@ func (s *KeeperTestSuite) TestMsgServerParams() { s.Require().Nil(resp) }) - s.Run("unable to process for version lower than current versions", func() { + s.Run("unable to process for invalid authority (valid bech32)", func() { msg := &types.MsgParams{ - Authority: s.authority.String(), - Params: types.NewParams( - types.DefaultMarketAuthority, - 0, - ), + Authority: sdk.AccAddress("invalid").String(), } resp, err := msgServer.Params(s.ctx, msg) s.Require().Error(err) s.Require().Nil(resp) }) - s.Run("unable to process a req with no params", func() { + s.Run("accepts a req with valid params", func() { msg := &types.MsgParams{ Authority: s.authority.String(), + Params: types.Params{ + MarketAuthorities: []string{types.DefaultMarketAuthority, sample.Address(r)}, + Admin: sample.Address(r), + }, } resp, err := msgServer.Params(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + + params, err := s.keeper.GetParams(s.ctx) + s.Require().NoError(err) + s.Require().Equal(msg.Params, params) + }) +} + +func (s *KeeperTestSuite) TestMsgServerRemoveMarketAuthorities() { + msgServer := keeper.NewMsgServer(s.keeper) + + s.Run("unable to process nil request", func() { + resp, err := msgServer.RemoveMarketAuthorities(s.ctx, nil) s.Require().Error(err) s.Require().Nil(resp) }) - s.Run("accepts a req with valid params", func() { - msg := &types.MsgParams{ - Authority: s.authority.String(), - Params: types.NewParams( - types.DefaultMarketAuthority, - 11, - ), + s.Run("unable to process for invalid authority", func() { + msg := &types.MsgRemoveMarketAuthorities{ + Admin: "invalid", } - resp, err := msgServer.Params(s.ctx, msg) + resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + }) + + s.Run("accepts a req that removes one authority", func() { + msg := &types.MsgRemoveMarketAuthorities{ + Admin: s.admin, + RemoveAddresses: []string{s.marketAuthorities[0]}, + } + resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) s.Require().NoError(err) s.Require().NotNil(resp) + // check new authorities params, err := s.keeper.GetParams(s.ctx) s.Require().NoError(err) - s.Require().Equal(msg.Params, params) + s.Require().Equal(s.marketAuthorities[1:], params.MarketAuthorities) + + // reset + s.Require().NoError(s.keeper.SetParams(s.ctx, types.Params{ + MarketAuthorities: s.marketAuthorities, + Admin: s.admin, + })) + }) + + s.Run("accepts a req that removes multiple authorities", func() { + msg := &types.MsgRemoveMarketAuthorities{ + Admin: s.admin, + RemoveAddresses: []string{s.marketAuthorities[0], s.marketAuthorities[2]}, + } + resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) + s.Require().NoError(err) + s.Require().NotNil(resp) + + // check new authorities + params, err := s.keeper.GetParams(s.ctx) + s.Require().NoError(err) + s.Require().Equal([]string{s.marketAuthorities[1]}, params.MarketAuthorities) + + // reset + s.Require().NoError(s.keeper.SetParams(s.ctx, types.Params{ + MarketAuthorities: s.marketAuthorities, + Admin: s.admin, + })) + }) + + s.Run("unable to accept a req that removes more authorities than exist in state", func() { + msg := &types.MsgRemoveMarketAuthorities{ + Admin: s.admin, + RemoveAddresses: []string{sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r)}, + } + resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) + s.Require().Error(err) + s.Require().Nil(resp) + + // reset + s.Require().NoError(s.keeper.SetParams(s.ctx, types.Params{ + MarketAuthorities: s.marketAuthorities, + Admin: s.admin, + })) }) } diff --git a/x/mm2/keeper/query.go b/x/marketmap/keeper/query.go similarity index 98% rename from x/mm2/keeper/query.go rename to x/marketmap/keeper/query.go index 94185b0eb..9851b7b9f 100644 --- a/x/mm2/keeper/query.go +++ b/x/marketmap/keeper/query.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/skip-mev/slinky/x/mm2/types" + "github.com/skip-mev/slinky/x/marketmap/types" ) type queryServerImpl struct { diff --git a/x/mm2/keeper/query_test.go b/x/marketmap/keeper/query_test.go similarity index 97% rename from x/mm2/keeper/query_test.go rename to x/marketmap/keeper/query_test.go index c9ff1fda8..57b2b2934 100644 --- a/x/mm2/keeper/query_test.go +++ b/x/marketmap/keeper/query_test.go @@ -2,8 +2,8 @@ package keeper_test import ( slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/mm2/keeper" - "github.com/skip-mev/slinky/x/mm2/types" + "github.com/skip-mev/slinky/x/marketmap/keeper" + "github.com/skip-mev/slinky/x/marketmap/types" ) func (s *KeeperTestSuite) TestMarketMap() { diff --git a/x/mm2/module.go b/x/marketmap/module.go similarity index 96% rename from x/mm2/module.go rename to x/marketmap/module.go index 6493f3b07..2682591e0 100644 --- a/x/mm2/module.go +++ b/x/marketmap/module.go @@ -1,4 +1,4 @@ -package mm2 +package marketmap import ( "context" @@ -20,10 +20,10 @@ import ( "github.com/spf13/cobra" "golang.org/x/exp/maps" - marketmapmodulev1 "github.com/skip-mev/slinky/api/slinky/mm2/module/v1" - "github.com/skip-mev/slinky/x/mm2/client/cli" - "github.com/skip-mev/slinky/x/mm2/keeper" - "github.com/skip-mev/slinky/x/mm2/types" + marketmapmodulev1 "github.com/skip-mev/slinky/api/slinky/marketmap/module/v1" + "github.com/skip-mev/slinky/x/marketmap/client/cli" + "github.com/skip-mev/slinky/x/marketmap/keeper" + "github.com/skip-mev/slinky/x/marketmap/types" ) // ConsensusVersion is the x/marketmap module's current version, as modules integrate and updates are made, this value determines what diff --git a/x/marketmap/module/depinject.go b/x/marketmap/module/depinject.go deleted file mode 100644 index ffb966f9c..000000000 --- a/x/marketmap/module/depinject.go +++ /dev/null @@ -1,103 +0,0 @@ -package module - -import ( - "fmt" - "sort" - - "cosmossdk.io/core/appmodule" - "cosmossdk.io/core/store" - "cosmossdk.io/depinject" - "github.com/cosmos/cosmos-sdk/codec" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "golang.org/x/exp/maps" - - marketmapmodulev1 "github.com/skip-mev/slinky/api/slinky/marketmap/module/v1" - "github.com/skip-mev/slinky/x/marketmap/keeper" - "github.com/skip-mev/slinky/x/marketmap/types" -) - -var _ depinject.OnePerModuleType = AppModule{} - -func init() { - appmodule.Register( - &marketmapmodulev1.Module{}, - appmodule.Provide(ProvideModule), - appmodule.Invoke(InvokeSetMarketMapHooks), - ) -} - -// Inputs contains the dependencies required for module construction. -type Inputs struct { - depinject.In - - // module dependencies - Config *marketmapmodulev1.Module - Cdc codec.Codec - StoreService store.KVStoreService -} - -// Outputs defines the constructor outputs for the module. -type Outputs struct { - depinject.Out - - MarketMapKeeper *keeper.Keeper - Module appmodule.AppModule -} - -// ProvideModule is the depinject constructor for the module. -func ProvideModule(in Inputs) Outputs { - authority := authtypes.NewModuleAddress(govtypes.ModuleName) - if in.Config.Authority != "" { - authority = authtypes.NewModuleAddressOrBech32Address(in.Config.Authority) - } - - marketmapKeeper := keeper.NewKeeper(in.StoreService, in.Cdc, authority) - - m := NewAppModule(in.Cdc, marketmapKeeper) - - return Outputs{ - MarketMapKeeper: marketmapKeeper, - Module: m, - } -} - -// InvokeSetMarketMapHooks uses the module config to set the hooks on the module. -func InvokeSetMarketMapHooks( - config *marketmapmodulev1.Module, - keeper *keeper.Keeper, - hooks map[string]types.MarketMapHooksWrapper, -) error { - // all arguments to invokers are optional - if keeper == nil || config == nil { - return nil - } - - modNames := maps.Keys(hooks) - order := config.HooksOrder - if len(order) == 0 { - order = modNames - sort.Strings(order) - } - - if len(order) != len(modNames) { - return fmt.Errorf("len(hooks_order: %v) != len(hooks modules: %v)", order, modNames) - } - - if len(modNames) == 0 { - return nil - } - - var multiHooks types.MultiMarketMapHooks - for _, modName := range order { - hook, ok := hooks[modName] - if !ok { - return fmt.Errorf("can't find marketmap hooks for module %s", modName) - } - - multiHooks = append(multiHooks, hook) - } - - keeper.SetHooks(multiHooks) - return nil -} diff --git a/x/marketmap/module/module.go b/x/marketmap/module/module.go deleted file mode 100644 index e6b38eac5..000000000 --- a/x/marketmap/module/module.go +++ /dev/null @@ -1,158 +0,0 @@ -package module - -import ( - "context" - "encoding/json" - - "cosmossdk.io/core/appmodule" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - - "github.com/skip-mev/slinky/x/marketmap/client/cli" - "github.com/skip-mev/slinky/x/marketmap/keeper" - "github.com/skip-mev/slinky/x/marketmap/types" -) - -// ConsensusVersion is the x/marketmap module's current version, as modules integrate and updates are made, this value determines what -// version of the module is being run by the chain. -const ConsensusVersion = 1 - -var ( - _ module.HasName = AppModule{} - _ module.HasGenesis = AppModule{} - _ module.AppModuleBasic = AppModule{} - _ module.HasServices = AppModule{} - - _ appmodule.AppModule = AppModule{} - _ appmodule.HasBeginBlocker = AppModule{} - _ appmodule.HasEndBlocker = AppModule{} -) - -// AppModuleBasic is the base struct for the x/marketmap module. It implements the module.AppModuleBasic interface. -type AppModuleBasic struct { - cdc codec.Codec -} - -// Name returns the canonical name of the module. -func (amb AppModuleBasic) Name() string { - return types.ModuleName -} - -// GetTxCmd is a no-op, as no txs are registered for submission (apart from messages that can only be executed by governance). -func (amb AppModuleBasic) GetTxCmd() *cobra.Command { - return nil -} - -// GetQueryCmd returns the x/oracle module base query cli-command. -func (amb AppModuleBasic) GetQueryCmd() *cobra.Command { - return cli.GetQueryCmd() -} - -// RegisterLegacyAminoCodec registers the necessary types from the x/marketmap module for amino serialization. -func (amb AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - types.RegisterLegacyAminoCodec(cdc) -} - -// RegisterInterfaces registers the necessary implementations / interfaces in the x/marketmap module w/ the interface-registry ir. -func (amb AppModuleBasic) RegisterInterfaces(ir codectypes.InterfaceRegistry) { - types.RegisterInterfaces(ir) -} - -// RegisterGRPCGatewayRoutes registers the necessary REST routes for the GRPC-gateway to the x/marketmap module QueryService on mux. -// This method panics on failure. -func (amb AppModuleBasic) RegisterGRPCGatewayRoutes(cliCtx client.Context, mux *runtime.ServeMux) { - // register the gate-way routes w/ the provided mux - if err := types.RegisterQueryHandlerClient(context.Background(), mux, types.NewQueryClient(cliCtx)); err != nil { - panic(err) - } -} - -// DefaultGenesis returns default genesis state as raw bytes for the marketmap -// module. -func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { - gs := types.DefaultGenesisState() - return cdc.MustMarshalJSON(gs) -} - -// ValidateGenesis performs genesis state validation for the marketmap module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { - var gs types.GenesisState - if err := cdc.UnmarshalJSON(bz, &gs); err != nil { - return err - } - - return gs.ValidateBasic() -} - -// RegisterInvariants registers the invariants of the marketmap module. If an invariant -// deviates from its predicted value, the InvariantRegistry triggers appropriate -// logic (most often the chain will be halted). No invariants exist for the marketmap module. -func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} - -// AppModule is the actual app module for x/marketmap. -type AppModule struct { - AppModuleBasic - k *keeper.Keeper -} - -// BeginBlock is a no-op for x/marketmap. -func (am AppModule) BeginBlock(_ context.Context) error { - return nil -} - -// EndBlock is a no-op for x/marketmap. -func (am AppModule) EndBlock(_ context.Context) error { - return nil -} - -// InitGenesis performs the genesis initialization for the x/marketmap module. It determines the -// genesis state to initialize from via a json-encoded genesis-state. This method returns no validator set updates. -// This method panics on any errors. -func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, bz json.RawMessage) { - // unmarshal genesis-state (panic on errors) - var gs types.GenesisState - cdc.MustUnmarshalJSON(bz, &gs) - - // initialize genesis - am.k.InitGenesis(ctx, gs) -} - -// ExportGenesis returns the oracle module's exported genesis state as raw -// JSON bytes. This method panics on any error. -func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage { - gs := am.k.ExportGenesis(ctx) - return cdc.MustMarshalJSON(gs) -} - -// RegisterServices registers the module's services with the app's module configurator. -func (am AppModule) RegisterServices(cfc module.Configurator) { - // register MsgServer - types.RegisterMsgServer(cfc.MsgServer(), keeper.NewMsgServer(am.k)) - - // register Query Service - types.RegisterQueryServer(cfc.QueryServer(), keeper.NewQueryServer(am.k)) -} - -// ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } - -// IsOnePerModuleType implements the depinject.OnePerModuleType interface. -func (am AppModule) IsOnePerModuleType() {} - -// IsAppModule implements the appmodule.AppModule interface. It is a no-op. -func (am AppModule) IsAppModule() {} - -// NewAppModule constructs a new application module for the x/marketmap module. -func NewAppModule(cdc codec.Codec, k *keeper.Keeper) AppModule { - return AppModule{ - AppModuleBasic: AppModuleBasic{ - cdc: cdc, - }, - k: k, - } -} diff --git a/x/marketmap/types/codec.go b/x/marketmap/types/codec.go index a1419fd96..7e90eef60 100644 --- a/x/marketmap/types/codec.go +++ b/x/marketmap/types/codec.go @@ -12,7 +12,8 @@ import ( // cdc. These types are used for amino serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { // register the msg-types - legacy.RegisterAminoMsg(cdc, &MsgUpdateMarketMap{}, "slinky/x/marketmap/MsgUpdateMarketMap") + legacy.RegisterAminoMsg(cdc, &MsgCreateMarkets{}, "slinky/x/marketmap/MsgCreateMarkets") + legacy.RegisterAminoMsg(cdc, &MsgUpdateMarkets{}, "slinky/x/marketmap/MsgUpdateMarkets") legacy.RegisterAminoMsg(cdc, &MsgParams{}, "slinky/x/marketmap/MsgParams") } @@ -20,7 +21,8 @@ func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { func RegisterInterfaces(registry codectypes.InterfaceRegistry) { // register the implementations of Msg-type registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgUpdateMarketMap{}, + &MsgCreateMarkets{}, + &MsgUpdateMarkets{}, &MsgParams{}, ) diff --git a/x/marketmap/types/errors.go b/x/marketmap/types/errors.go index d1d304916..effcebcf3 100644 --- a/x/marketmap/types/errors.go +++ b/x/marketmap/types/errors.go @@ -2,16 +2,30 @@ package types import "fmt" -// TickerAlreadyExistsError is an error indicating the given Ticker exists in state. -type TickerAlreadyExistsError struct { +// MarketAlreadyExistsError is an error indicating the given Market exists in state. +type MarketAlreadyExistsError struct { ticker TickerString } -func NewTickerAlreadyExistsError(ticker TickerString) TickerAlreadyExistsError { - return TickerAlreadyExistsError{ticker: ticker} +func NewMarketAlreadyExistsError(ticker TickerString) MarketAlreadyExistsError { + return MarketAlreadyExistsError{ticker: ticker} } -// Error returns the error string for TickerAlreadyExistsError. -func (e TickerAlreadyExistsError) Error() string { +// Error returns the error string for MarketAlreadyExistsError. +func (e MarketAlreadyExistsError) Error() string { return fmt.Sprintf("market already exists for ticker %s", e.ticker) } + +// MarketDoesNotExistsError is an error indicating the given Market does not exist in state. +type MarketDoesNotExistsError struct { + ticker TickerString +} + +func NewMarketDoesNotExistsError(ticker TickerString) MarketDoesNotExistsError { + return MarketDoesNotExistsError{ticker: ticker} +} + +// Error returns the error string for MarketDoesNotExistsError. +func (e MarketDoesNotExistsError) Error() string { + return fmt.Sprintf("market does not exist for ticker %s", e.ticker) +} diff --git a/x/marketmap/types/events.go b/x/marketmap/types/events.go index 5ef42df29..74e0ee560 100644 --- a/x/marketmap/types/events.go +++ b/x/marketmap/types/events.go @@ -10,6 +10,4 @@ const ( AttributeKeyDecimals = "decimals" AttributeKeyMinProviderCount = "min_provider_count" AttributeKeyMetadata = "metadata" - AttributeKeyProviders = "providers" - AttributeKeyPaths = "paths" ) diff --git a/x/marketmap/types/genesis.go b/x/marketmap/types/genesis.go index 8c97555c3..2b073dd5b 100644 --- a/x/marketmap/types/genesis.go +++ b/x/marketmap/types/genesis.go @@ -26,9 +26,7 @@ func (gs *GenesisState) ValidateBasic() error { func DefaultGenesisState() *GenesisState { return &GenesisState{ MarketMap: MarketMap{ - Tickers: make(map[string]Ticker), - Paths: make(map[string]Paths), - Providers: make(map[string]Providers), + Markets: make(map[string]Market), }, LastUpdated: 0, Params: DefaultParams(), diff --git a/x/marketmap/types/genesis_test.go b/x/marketmap/types/genesis_test.go index 512364f0d..04584e1ef 100644 --- a/x/marketmap/types/genesis_test.go +++ b/x/marketmap/types/genesis_test.go @@ -17,54 +17,17 @@ func TestGenesisState(t *testing.T) { t.Run("invalid params - fail", func(t *testing.T) { gs := types.DefaultGenesisState() - gs.Params.MarketAuthority = "invalid" + gs.Params.MarketAuthorities = []string{"invalid"} require.Error(t, gs.ValidateBasic()) }) t.Run("good populated genesis state", func(t *testing.T) { gs := types.GenesisState{ MarketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, + Markets: markets, }, Params: types.DefaultParams(), } require.NoError(t, gs.ValidateBasic()) }) - - t.Run("bad genesis state - mistmatch", func(t *testing.T) { - gs := types.GenesisState{ - MarketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - usdtusd.String(): usdtusdProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, - }, - } - require.Error(t, gs.ValidateBasic()) - }) } diff --git a/x/marketmap/types/hooks.go b/x/marketmap/types/hooks.go index d76160dbc..401d3b65e 100644 --- a/x/marketmap/types/hooks.go +++ b/x/marketmap/types/hooks.go @@ -4,12 +4,14 @@ import sdk "github.com/cosmos/cosmos-sdk/types" // MarketMapHooks is the interface that defines the hooks that can be integrated by other modules. type MarketMapHooks interface { - LegacyAfterMarketCreated(ctx sdk.Context, ticker Ticker) error + // AfterMarketCreated is called after CreateMarket is called. + AfterMarketCreated(ctx sdk.Context, market Market) error - LegacyAfterMarketUpdated(ctx sdk.Context, ticker Ticker) error + // AfterMarketUpdated is called after UpdateMarket is called. + AfterMarketUpdated(ctx sdk.Context, market Market) error - // LegacyAfterMarketGenesis is called after x/marketmap init genesis. - LegacyAfterMarketGenesis(ctx sdk.Context, tickers map[string]Ticker) error + // AfterMarketGenesis is called after x/marketmap init genesis. + AfterMarketGenesis(ctx sdk.Context, tickers map[string]Market) error } var _ MarketMapHooks = &MultiMarketMapHooks{} @@ -17,10 +19,10 @@ var _ MarketMapHooks = &MultiMarketMapHooks{} // MultiMarketMapHooks defines an array of MarketMapHooks which can be executed in sequence. type MultiMarketMapHooks []MarketMapHooks -// LegacyAfterMarketCreated calls all AfterMarketCreated hooks registered to the MultiMarketMapHooks. -func (mh MultiMarketMapHooks) LegacyAfterMarketCreated(ctx sdk.Context, ticker Ticker) error { +// AfterMarketCreated calls all AfterMarketCreated hooks registered to the MultiMarketMapHooks. +func (mh MultiMarketMapHooks) AfterMarketCreated(ctx sdk.Context, market Market) error { for i := range mh { - if err := mh[i].LegacyAfterMarketCreated(ctx, ticker); err != nil { + if err := mh[i].AfterMarketCreated(ctx, market); err != nil { return err } } @@ -28,10 +30,10 @@ func (mh MultiMarketMapHooks) LegacyAfterMarketCreated(ctx sdk.Context, ticker T return nil } -// LegacyAfterMarketUpdated calls all AfterMarketUpdated hooks registered to the MultiMarketMapHooks. -func (mh MultiMarketMapHooks) LegacyAfterMarketUpdated(ctx sdk.Context, ticker Ticker) error { +// AfterMarketUpdated calls all AfterMarketUpdated hooks registered to the MultiMarketMapHooks. +func (mh MultiMarketMapHooks) AfterMarketUpdated(ctx sdk.Context, market Market) error { for i := range mh { - if err := mh[i].LegacyAfterMarketUpdated(ctx, ticker); err != nil { + if err := mh[i].AfterMarketUpdated(ctx, market); err != nil { return err } } @@ -39,10 +41,10 @@ func (mh MultiMarketMapHooks) LegacyAfterMarketUpdated(ctx sdk.Context, ticker T return nil } -// LegacyAfterMarketGenesis calls all AfterMarketGenesis hooks registered to the MultiMarketMapHooks. -func (mh MultiMarketMapHooks) LegacyAfterMarketGenesis(ctx sdk.Context, tickers map[string]Ticker) error { +// AfterMarketGenesis calls all AfterMarketGenesis hooks registered to the MultiMarketMapHooks. +func (mh MultiMarketMapHooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]Market) error { for i := range mh { - if err := mh[i].LegacyAfterMarketGenesis(ctx, tickers); err != nil { + if err := mh[i].AfterMarketGenesis(ctx, markets); err != nil { return err } } diff --git a/x/marketmap/types/keys.go b/x/marketmap/types/keys.go index b9312197b..85700ed5b 100644 --- a/x/marketmap/types/keys.go +++ b/x/marketmap/types/keys.go @@ -13,20 +13,14 @@ const ( ) var ( - // TickersPrefix is the key prefix for Tickers. - TickersPrefix = collections.NewPrefix(0) - - // PathsPrefix is the key prefix for Paths. - PathsPrefix = collections.NewPrefix(1) - - // ProvidersPrefix is the key prefix for Providers. - ProvidersPrefix = collections.NewPrefix(2) - // LastUpdatedPrefix is the key prefix for the lastUpdated height. - LastUpdatedPrefix = collections.NewPrefix(3) + LastUpdatedPrefix = collections.NewPrefix(1) + + // MarketsPrefix is the key prefix for Markets. + MarketsPrefix = collections.NewPrefix(2) // ParamsPrefix is the key prefix of the module Params. - ParamsPrefix = collections.NewPrefix(4) + ParamsPrefix = collections.NewPrefix(3) // TickersCodec is the collections.KeyCodec value used for the markets map. TickersCodec = codec.NewStringKeyCodec[TickerString]() diff --git a/x/marketmap/types/market.go b/x/marketmap/types/market.go index 1d0c5b142..93b916196 100644 --- a/x/marketmap/types/market.go +++ b/x/marketmap/types/market.go @@ -2,176 +2,111 @@ package types import ( "fmt" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" -) - -const ( - // MaxConversionOperations is the maximum number of conversion operations that can be used - // to convert a set of prices to a common ticker. This implementation only supports a maximum - // of 2 conversion operations - either a direct conversion or a conversion using the index price. - // This is specific to the IndexPriceAggregation. - MaxConversionOperations = 2 - - // IndexPrice is the provider name for the index price. This is specific to the IndexPriceAggregation. - IndexPrice = "index_price" ) -// ValidateBasic performs aggregate validation for all fields in the MarketMap. We consider -// the market map to be valid iff: +// ValidateBasic validates the market map configuration and its expected configuration. // -// 1. Each ticker a provider supports is included in the main set of tickers. -// 2. Each ticker is valid. -// 3. Each provider is valid. +// In particular, this will +// +// 1. Ensure that the market map is valid (ValidateBasic). This ensures that each of the provider's +// markets are supported by the market map. +// 2. Ensure that each provider config has a valid corresponding ticker. func (mm *MarketMap) ValidateBasic() error { - if len(mm.Tickers) < len(mm.Providers) { - return fmt.Errorf("each ticker a provider includes must have a corresponding ticker in the main set of tickers") - } - - seenCPs := make(map[string]struct{}) - for tickerStr, ticker := range mm.Tickers { - if err := ticker.ValidateBasic(); err != nil { + for _, market := range mm.Markets { + if err := market.ValidateBasic(); err != nil { return err } - if tickerStr != ticker.String() { - return fmt.Errorf("ticker string %s does not match ticker %s", tickerStr, ticker.String()) + for _, providerConfig := range market.ProviderConfigs { + if providerConfig.NormalizeByPair != nil { + if _, found := mm.Markets[providerConfig.NormalizeByPair.String()]; !found { + return fmt.Errorf("provider's (%s) pair for normalization (%s) was not found in the marketmap", providerConfig.Name, providerConfig.NormalizeByPair.String()) + } + } } - - seenCPs[ticker.String()] = struct{}{} } - // check if all providers refer to tickers - for tickerStr, providers := range mm.Providers { - // check if the ticker is supported - if _, ok := mm.Tickers[tickerStr]; !ok { - return fmt.Errorf("provider %s refers to an unsupported ticker", tickerStr) - } - - if err := providers.ValidateBasic(); err != nil { - return fmt.Errorf("ticker %s has invalid providers: %w", tickerStr, err) - } - } - return ValidateIndexPriceAggregation(*mm) + return nil } // String returns the string representation of the market map. func (mm *MarketMap) String() string { return fmt.Sprintf( - "MarketMap: {Tickers: %v, Providers: %v, Paths: %v, AggregationType: %s}", - mm.Tickers, - mm.Providers, - mm.Paths, - mm.AggregationType, + "MarketMap: {Markets %v}", + mm.Markets, ) } -// ValidateIndexPriceAggregation validates the market map configuration and its expected configuration for -// this aggregator. In particular, this will -// -// 1. Ensure that the market map is valid (ValidateBasic). This ensures that each of the provider's -// markets are supported by the market map. -// 2. Ensure that each path has a corresponding ticker. -// 3. Ensure that each path has a valid number of operations. -// 4. Ensure that each operation has a valid ticker and that the provider supports the ticker. -func ValidateIndexPriceAggregation( - marketMap MarketMap, -) error { - for ticker, paths := range marketMap.Paths { - // The ticker must be supported by the market map. Otherwise, we do not how to resolve the - // prices. - if _, ok := marketMap.Tickers[ticker]; !ok { - return fmt.Errorf("path includes a ticker that is not supported: %s", ticker) - } - - for _, path := range paths.Paths { - operations := path.Operations - if len(operations) == 0 || len(operations) > MaxConversionOperations { - return fmt.Errorf( - "the expected number of operations is between 1 and %d; got %d operations for %s", - MaxConversionOperations, - len(operations), - ticker, - ) - } +// ValidateBasic performs stateless validation of a Market. +func (m *Market) ValidateBasic() error { + if err := m.Ticker.ValidateBasic(); err != nil { + return err + } - first := operations[0] - if _, ok := marketMap.Tickers[first.CurrencyPair.String()]; !ok { - return fmt.Errorf("operation included a ticker that is not supported: %s", first.CurrencyPair.String()) - } - if err := checkIfProviderSupportsTicker(first.Provider, first.CurrencyPair, marketMap); err != nil { - return err - } + if uint64(len(m.ProviderConfigs)) < m.Ticker.MinProviderCount { + return fmt.Errorf("this ticker must have at least %d providers; got %d", + m.Ticker.MinProviderCount, + len(m.ProviderConfigs), + ) + } - if len(operations) != 2 { - continue - } + seenProviders := make(map[string]struct{}) + for _, providerConfig := range m.ProviderConfigs { + if err := providerConfig.ValidateBasic(); err != nil { + return err + } - second := operations[1] - if second.Provider != IndexPrice { - return fmt.Errorf("expected index price provider for second operation; got %s", second.Provider) - } - if _, ok := marketMap.Tickers[second.CurrencyPair.String()]; !ok { - return fmt.Errorf("index operation included a ticker that is not supported: %s", second.CurrencyPair.String()) - } + // check for duplicate providers + key := providerConfig.Name + providerConfig.OffChainTicker + if _, seen := seenProviders[key]; seen { + return fmt.Errorf("duplicate (provider, off-chain-ticker) found: %s", key) } + seenProviders[key] = struct{}{} + } return nil } -// checkIfProviderSupportsTicker checks if the provider supports the given ticker. -func checkIfProviderSupportsTicker( - provider string, - cp slinkytypes.CurrencyPair, - marketMap MarketMap, -) error { - providers, ok := marketMap.Providers[cp.String()] - if !ok { - return fmt.Errorf("provider %s included a ticker %s that has no providers supporting it", provider, cp.String()) - } - - for _, p := range providers.Providers { - if p.Name == provider { - return nil - } - } - - return fmt.Errorf("provider %s does not support ticker: %s", provider, cp.String()) +// String returns the string representation of the market. +func (m *Market) String() string { + return fmt.Sprintf( + "Market: {Ticker %v Providers: %v}", m.Ticker, m.ProviderConfigs, + ) } -// Equal returns true iff the MarketMap is equal to the given MarketMap. +// Equal returns true if the MarketMap is equal to the given MarketMap. func (mm *MarketMap) Equal(other MarketMap) bool { - if len(mm.Tickers) != len(other.Tickers) { + if len(mm.Markets) != len(other.Markets) { return false } - if len(mm.Providers) != len(other.Providers) { - return false - } + for tickerStr, market := range mm.Markets { + otherMarket, found := other.Markets[tickerStr] + if !found { + return false + } - if len(mm.Paths) != len(other.Paths) { - return false + if !market.Equal(otherMarket) { + return false + } } - if mm.AggregationType != other.AggregationType { - return false - } + return true +} - for ticker, tickerData := range mm.Tickers { - if !tickerData.Equal(other.Tickers[ticker]) { - return false - } +// Equal returns true if the Market is equal to the given Market. +func (m *Market) Equal(other Market) bool { + if !m.Ticker.Equal(other.Ticker) { + return false } - for ticker, providerData := range mm.Providers { - if !providerData.Equal(other.Providers[ticker]) { - return false - } + if len(m.ProviderConfigs) != len(other.ProviderConfigs) { + return false } - for ticker, pathData := range mm.Paths { - if !pathData.Equal(other.Paths[ticker]) { + for i, providerConfig := range m.ProviderConfigs { + if !providerConfig.Equal(other.ProviderConfigs[i]) { return false } } diff --git a/x/marketmap/types/market.pb.go b/x/marketmap/types/market.pb.go index aeacda200..54be4408c 100644 --- a/x/marketmap/types/market.pb.go +++ b/x/marketmap/types/market.pb.go @@ -24,42 +24,60 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// AggregationType is the type of aggregation that will be used to aggregate the -// prices of the tickers. -type AggregationType int32 - -const ( - // UNKOWN_AGGREGATION_TYPE is the default value for the aggregation type. - AggregationType_UNKNOWN_AGGREGATION_TYPE AggregationType = 0 - // IndexPriceAggregation is the type of aggregation that will be used to - // aggregate the prices of the tickers. Specifically, this converts the prices - // either directly or using the index price to a common currency pair. - AggregationType_INDEX_PRICE_AGGREGATION AggregationType = 1 - // StandardMedianAggregation is the type of aggregation that will be used to - // aggregate the prices of the tickers. Specifically, this converts the prices - // to a common currency pair and then takes the median of the prices. No - // conversions are done if the prices are already in the common currency pair. - AggregationType_STANDARD_MEDIAN_AGGREGATION AggregationType = 2 -) - -var AggregationType_name = map[int32]string{ - 0: "UNKNOWN_AGGREGATION_TYPE", - 1: "INDEX_PRICE_AGGREGATION", - 2: "STANDARD_MEDIAN_AGGREGATION", +// Market encapsulates a Ticker and its provider-specific configuration. +type Market struct { + // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The + // price feed is scaled to a number of decimal places and has a minimum number + // of providers required to consider the ticker valid. + Ticker Ticker `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker"` + // ProviderConfigs is the list of provider-specific configs for this Market. + ProviderConfigs []ProviderConfig `protobuf:"bytes,2,rep,name=provider_configs,json=providerConfigs,proto3" json:"provider_configs"` +} + +func (m *Market) Reset() { *m = Market{} } +func (*Market) ProtoMessage() {} +func (*Market) Descriptor() ([]byte, []int) { + return fileDescriptor_fefe265720fc8a78, []int{0} } - -var AggregationType_value = map[string]int32{ - "UNKNOWN_AGGREGATION_TYPE": 0, - "INDEX_PRICE_AGGREGATION": 1, - "STANDARD_MEDIAN_AGGREGATION": 2, +func (m *Market) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Market) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Market.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Market) XXX_Merge(src proto.Message) { + xxx_messageInfo_Market.Merge(m, src) +} +func (m *Market) XXX_Size() int { + return m.Size() +} +func (m *Market) XXX_DiscardUnknown() { + xxx_messageInfo_Market.DiscardUnknown(m) } -func (x AggregationType) String() string { - return proto.EnumName(AggregationType_name, int32(x)) +var xxx_messageInfo_Market proto.InternalMessageInfo + +func (m *Market) GetTicker() Ticker { + if m != nil { + return m.Ticker + } + return Ticker{} } -func (AggregationType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{0} +func (m *Market) GetProviderConfigs() []ProviderConfig { + if m != nil { + return m.ProviderConfigs + } + return nil } // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price @@ -85,7 +103,7 @@ type Ticker struct { func (m *Ticker) Reset() { *m = Ticker{} } func (*Ticker) ProtoMessage() {} func (*Ticker) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{0} + return fileDescriptor_fefe265720fc8a78, []int{1} } func (m *Ticker) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -157,13 +175,24 @@ type ProviderConfig struct { // The off-chain ticker is unique to a given provider and is used to fetch the // price of the ticker from the provider. OffChainTicker string `protobuf:"bytes,2,opt,name=off_chain_ticker,json=offChainTicker,proto3" json:"off_chain_ticker,omitempty"` + // NormalizeByPair is the currency pair for this ticker to be normalized by. + // For example, if the desired Ticker is BTD/USD, this market could be reached + // using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is + // optional and nullable. + NormalizeByPair *types.CurrencyPair `protobuf:"bytes,3,opt,name=normalize_by_pair,json=normalizeByPair,proto3" json:"normalize_by_pair,omitempty"` + // Invert is a boolean indicating if the BASE and QUOTE of the market should + // be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE + Invert bool `protobuf:"varint,4,opt,name=invert,proto3" json:"invert,omitempty"` + // MetadataJSON is a string of JSON that encodes any extra configuration + // for the given provider config. + Metadata_JSON string `protobuf:"bytes,15,opt,name=metadata_JSON,json=metadataJSON,proto3" json:"metadata_JSON,omitempty"` } func (m *ProviderConfig) Reset() { *m = ProviderConfig{} } func (m *ProviderConfig) String() string { return proto.CompactTextString(m) } func (*ProviderConfig) ProtoMessage() {} func (*ProviderConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{1} + return fileDescriptor_fefe265720fc8a78, []int{2} } func (m *ProviderConfig) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -206,229 +235,38 @@ func (m *ProviderConfig) GetOffChainTicker() string { return "" } -// Path is the list of convertable markets that will be used to convert the -// prices of a set of tickers to a common ticker. -type Path struct { - // Operations is an ordered list of operations that will be taken. These must - // be topologically sorted to ensure that the conversion is possible i.e. DAG. - Operations []Operation `protobuf:"bytes,1,rep,name=operations,proto3" json:"operations"` -} - -func (m *Path) Reset() { *m = Path{} } -func (m *Path) String() string { return proto.CompactTextString(m) } -func (*Path) ProtoMessage() {} -func (*Path) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{2} -} -func (m *Path) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Path) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Path.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 *Path) XXX_Merge(src proto.Message) { - xxx_messageInfo_Path.Merge(m, src) -} -func (m *Path) XXX_Size() int { - return m.Size() -} -func (m *Path) XXX_DiscardUnknown() { - xxx_messageInfo_Path.DiscardUnknown(m) -} - -var xxx_messageInfo_Path proto.InternalMessageInfo - -func (m *Path) GetOperations() []Operation { +func (m *ProviderConfig) GetNormalizeByPair() *types.CurrencyPair { if m != nil { - return m.Operations + return m.NormalizeByPair } return nil } -// Operation represents the operation configuration for a given ticker. -type Operation struct { - // CurrencyPair is the on-chain currency pair for this ticker. - CurrencyPair types.CurrencyPair `protobuf:"bytes,1,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair"` - // Invert is a boolean that indicates whether the price of the ticker should - // be inverted. - Invert bool `protobuf:"varint,2,opt,name=invert,proto3" json:"invert,omitempty"` - // Provider is the name of the provider that will be used to fetch the price - // of the ticker. - Provider string `protobuf:"bytes,3,opt,name=provider,proto3" json:"provider,omitempty"` -} - -func (m *Operation) Reset() { *m = Operation{} } -func (m *Operation) String() string { return proto.CompactTextString(m) } -func (*Operation) ProtoMessage() {} -func (*Operation) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{3} -} -func (m *Operation) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Operation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Operation.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 *Operation) XXX_Merge(src proto.Message) { - xxx_messageInfo_Operation.Merge(m, src) -} -func (m *Operation) XXX_Size() int { - return m.Size() -} -func (m *Operation) XXX_DiscardUnknown() { - xxx_messageInfo_Operation.DiscardUnknown(m) -} - -var xxx_messageInfo_Operation proto.InternalMessageInfo - -func (m *Operation) GetCurrencyPair() types.CurrencyPair { - if m != nil { - return m.CurrencyPair - } - return types.CurrencyPair{} -} - -func (m *Operation) GetInvert() bool { +func (m *ProviderConfig) GetInvert() bool { if m != nil { return m.Invert } return false } -func (m *Operation) GetProvider() string { +func (m *ProviderConfig) GetMetadata_JSON() string { if m != nil { - return m.Provider + return m.Metadata_JSON } return "" } -type Paths struct { - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - Paths []Path `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths"` -} - -func (m *Paths) Reset() { *m = Paths{} } -func (m *Paths) String() string { return proto.CompactTextString(m) } -func (*Paths) ProtoMessage() {} -func (*Paths) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{4} -} -func (m *Paths) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Paths) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Paths.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 *Paths) XXX_Merge(src proto.Message) { - xxx_messageInfo_Paths.Merge(m, src) -} -func (m *Paths) XXX_Size() int { - return m.Size() -} -func (m *Paths) XXX_DiscardUnknown() { - xxx_messageInfo_Paths.DiscardUnknown(m) -} - -var xxx_messageInfo_Paths proto.InternalMessageInfo - -func (m *Paths) GetPaths() []Path { - if m != nil { - return m.Paths - } - return nil -} - -type Providers struct { - // Providers is the list of provider configurations for the given ticker. - Providers []ProviderConfig `protobuf:"bytes,1,rep,name=providers,proto3" json:"providers"` -} - -func (m *Providers) Reset() { *m = Providers{} } -func (m *Providers) String() string { return proto.CompactTextString(m) } -func (*Providers) ProtoMessage() {} -func (*Providers) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{5} -} -func (m *Providers) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Providers) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Providers.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 *Providers) XXX_Merge(src proto.Message) { - xxx_messageInfo_Providers.Merge(m, src) -} -func (m *Providers) XXX_Size() int { - return m.Size() -} -func (m *Providers) XXX_DiscardUnknown() { - xxx_messageInfo_Providers.DiscardUnknown(m) -} - -var xxx_messageInfo_Providers proto.InternalMessageInfo - -func (m *Providers) GetProviders() []ProviderConfig { - if m != nil { - return m.Providers - } - return nil -} - +// MarketMap maps ticker strings to their Markets. type MarketMap struct { - // Tickers is the full list of tickers and their associated configurations + // Markets is the full list of tickers and their associated configurations // to be stored on-chain. - Tickers map[string]Ticker `protobuf:"bytes,1,rep,name=tickers,proto3" json:"tickers" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Paths is a map from CurrencyPair to all paths that resolve to that pair - Paths map[string]Paths `protobuf:"bytes,2,rep,name=paths,proto3" json:"paths" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // Providers is a map from CurrencyPair to each of to provider-specific - // configs associated with it. - Providers map[string]Providers `protobuf:"bytes,3,rep,name=providers,proto3" json:"providers" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` - // AggregationType is the type of aggregation that will be used to aggregate - // the prices of the tickers. - AggregationType AggregationType `protobuf:"varint,4,opt,name=aggregation_type,json=aggregationType,proto3,enum=slinky.marketmap.v1.AggregationType" json:"aggregation_type,omitempty"` + Markets map[string]Market `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } func (m *MarketMap) Reset() { *m = MarketMap{} } func (*MarketMap) ProtoMessage() {} func (*MarketMap) Descriptor() ([]byte, []int) { - return fileDescriptor_fefe265720fc8a78, []int{6} + return fileDescriptor_fefe265720fc8a78, []int{3} } func (m *MarketMap) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -457,99 +295,107 @@ func (m *MarketMap) XXX_DiscardUnknown() { var xxx_messageInfo_MarketMap proto.InternalMessageInfo -func (m *MarketMap) GetTickers() map[string]Ticker { - if m != nil { - return m.Tickers - } - return nil -} - -func (m *MarketMap) GetPaths() map[string]Paths { - if m != nil { - return m.Paths - } - return nil -} - -func (m *MarketMap) GetProviders() map[string]Providers { +func (m *MarketMap) GetMarkets() map[string]Market { if m != nil { - return m.Providers + return m.Markets } return nil } -func (m *MarketMap) GetAggregationType() AggregationType { - if m != nil { - return m.AggregationType - } - return AggregationType_UNKNOWN_AGGREGATION_TYPE -} - func init() { - proto.RegisterEnum("slinky.marketmap.v1.AggregationType", AggregationType_name, AggregationType_value) + proto.RegisterType((*Market)(nil), "slinky.marketmap.v1.Market") proto.RegisterType((*Ticker)(nil), "slinky.marketmap.v1.Ticker") proto.RegisterType((*ProviderConfig)(nil), "slinky.marketmap.v1.ProviderConfig") - proto.RegisterType((*Path)(nil), "slinky.marketmap.v1.Path") - proto.RegisterType((*Operation)(nil), "slinky.marketmap.v1.Operation") - proto.RegisterType((*Paths)(nil), "slinky.marketmap.v1.Paths") - proto.RegisterType((*Providers)(nil), "slinky.marketmap.v1.Providers") proto.RegisterType((*MarketMap)(nil), "slinky.marketmap.v1.MarketMap") - proto.RegisterMapType((map[string]Paths)(nil), "slinky.marketmap.v1.MarketMap.PathsEntry") - proto.RegisterMapType((map[string]Providers)(nil), "slinky.marketmap.v1.MarketMap.ProvidersEntry") - proto.RegisterMapType((map[string]Ticker)(nil), "slinky.marketmap.v1.MarketMap.TickersEntry") + proto.RegisterMapType((map[string]Market)(nil), "slinky.marketmap.v1.MarketMap.MarketsEntry") } func init() { proto.RegisterFile("slinky/marketmap/v1/market.proto", fileDescriptor_fefe265720fc8a78) } var fileDescriptor_fefe265720fc8a78 = []byte{ - // 743 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x95, 0xcf, 0x6f, 0xd3, 0x48, - 0x14, 0xc7, 0xe3, 0x24, 0x6d, 0xe3, 0xd7, 0x36, 0x8d, 0x66, 0x57, 0xbb, 0xde, 0x74, 0x71, 0xad, - 0x94, 0x43, 0x80, 0xd6, 0x21, 0x01, 0x24, 0xd4, 0x03, 0x52, 0x9a, 0x84, 0x10, 0x4a, 0x9d, 0xe0, - 0x06, 0x15, 0x10, 0x92, 0x35, 0x75, 0x26, 0xa9, 0x95, 0xf8, 0x87, 0x6c, 0x27, 0x22, 0x37, 0xae, - 0xdc, 0x38, 0x72, 0xe4, 0xcf, 0xe9, 0xb1, 0x47, 0x84, 0x10, 0x42, 0xad, 0xf8, 0x3f, 0x90, 0xc7, - 0x76, 0xe2, 0x20, 0x97, 0x5e, 0xb8, 0xcd, 0x7b, 0xf3, 0x7d, 0x9f, 0xd1, 0xfb, 0xbe, 0xf1, 0x18, - 0x04, 0x67, 0xa4, 0x19, 0xc3, 0x69, 0x49, 0xc7, 0xf6, 0x90, 0xb8, 0x3a, 0xb6, 0x4a, 0x93, 0x72, - 0x10, 0x88, 0x96, 0x6d, 0xba, 0x26, 0xfa, 0xcb, 0x57, 0x88, 0x33, 0x85, 0x38, 0x29, 0xe7, 0xff, - 0x1e, 0x98, 0x03, 0x93, 0xee, 0x97, 0xbc, 0x95, 0x2f, 0xcd, 0x6f, 0x07, 0x30, 0x77, 0x6a, 0x11, - 0xc7, 0x03, 0xa9, 0x63, 0xdb, 0x26, 0x86, 0x3a, 0x55, 0x2c, 0xac, 0xd9, 0xbe, 0xa8, 0xf0, 0x83, - 0x81, 0xe5, 0xae, 0xa6, 0x0e, 0x89, 0x8d, 0x9e, 0xc0, 0xfa, 0x82, 0x82, 0x63, 0x04, 0xa6, 0xb8, - 0x5a, 0xb9, 0x21, 0x06, 0x47, 0x52, 0x8e, 0x38, 0x29, 0x8b, 0xb5, 0x40, 0xd5, 0xc1, 0x9a, 0xbd, - 0x9f, 0x3e, 0xfb, 0xb6, 0x95, 0x90, 0xd7, 0xd4, 0x48, 0x0e, 0xe5, 0x21, 0xd3, 0x23, 0xaa, 0xa6, - 0xe3, 0x91, 0xc3, 0x25, 0x05, 0xa6, 0x98, 0x96, 0x67, 0x31, 0xda, 0x01, 0xa4, 0x6b, 0x86, 0x62, - 0xd9, 0xe6, 0x44, 0xeb, 0x11, 0x5b, 0x51, 0xcd, 0xb1, 0xe1, 0x72, 0x29, 0xaa, 0xca, 0xe9, 0x9a, - 0xd1, 0x09, 0x36, 0x6a, 0x5e, 0x1e, 0x71, 0xb0, 0x42, 0x0c, 0x7c, 0x32, 0x22, 0x3d, 0x2e, 0x2b, - 0x30, 0xc5, 0x8c, 0x1c, 0x86, 0x68, 0x1b, 0xd6, 0x75, 0xe2, 0xe2, 0x1e, 0x76, 0xb1, 0xf2, 0xf4, - 0xa8, 0x2d, 0x71, 0x1b, 0x02, 0x53, 0x64, 0xe5, 0xb5, 0x30, 0xe9, 0xe5, 0xf6, 0x32, 0x1f, 0x3f, - 0x6d, 0x25, 0xde, 0x7d, 0x15, 0x12, 0x05, 0x09, 0xb2, 0x73, 0xb2, 0xd1, 0xd7, 0x06, 0x08, 0x41, - 0xda, 0xc0, 0x3a, 0xa1, 0x5d, 0xb2, 0x32, 0x5d, 0xa3, 0x22, 0xe4, 0xcc, 0x7e, 0x5f, 0x51, 0x4f, - 0xb1, 0x66, 0x28, 0x2e, 0xb5, 0x85, 0x36, 0xc0, 0xca, 0x59, 0xb3, 0xdf, 0xaf, 0x79, 0x69, 0xdf, - 0xac, 0xc2, 0x33, 0x48, 0x77, 0xb0, 0x7b, 0x8a, 0xea, 0x00, 0xa6, 0x45, 0x6c, 0xec, 0x6a, 0xa6, - 0xe1, 0x70, 0x8c, 0x90, 0x2a, 0xae, 0x56, 0x78, 0x31, 0x66, 0x48, 0x62, 0x3b, 0x94, 0x05, 0x96, - 0x45, 0xea, 0x0a, 0xef, 0x19, 0x60, 0x67, 0xfb, 0x7f, 0x70, 0x10, 0xff, 0xc0, 0xb2, 0x66, 0x4c, - 0x88, 0xed, 0xd2, 0x2e, 0x32, 0x72, 0x10, 0x79, 0x03, 0x0a, 0x07, 0x40, 0xad, 0x67, 0xe5, 0x59, - 0x5c, 0x78, 0x04, 0x4b, 0x5e, 0x67, 0x0e, 0x7a, 0x00, 0x4b, 0x96, 0xb7, 0x08, 0xba, 0xfa, 0x2f, - 0xb6, 0x2b, 0x4f, 0x1a, 0x1c, 0xed, 0xab, 0x0b, 0x5d, 0x60, 0x43, 0xa7, 0x1d, 0xd4, 0x04, 0x36, - 0x04, 0x87, 0x9c, 0xed, 0x78, 0xce, 0xc2, 0x70, 0x02, 0xe2, 0xbc, 0xb6, 0xf0, 0x25, 0x0d, 0xec, - 0x21, 0x2d, 0x38, 0xc4, 0x16, 0x3a, 0x80, 0x15, 0x7f, 0x3a, 0x21, 0xf4, 0x4e, 0x2c, 0x74, 0x56, - 0x20, 0xfa, 0x53, 0x73, 0x1a, 0x86, 0x6b, 0x4f, 0x03, 0x78, 0x48, 0x40, 0x8d, 0xb0, 0xcf, 0x24, - 0x45, 0xdd, 0xba, 0x06, 0x45, 0xcd, 0x89, 0x82, 0xfc, 0x6a, 0xf4, 0x3c, 0xda, 0x6a, 0x8a, 0xa2, - 0x76, 0xaf, 0x43, 0x85, 0xfa, 0x28, 0x6e, 0x4e, 0x41, 0x6d, 0xc8, 0xe1, 0xc1, 0xc0, 0x26, 0x03, - 0x7a, 0x2f, 0x14, 0x6f, 0xee, 0x5c, 0x5a, 0x60, 0x8a, 0xd9, 0xca, 0xcd, 0x58, 0x72, 0x75, 0x2e, - 0xee, 0x4e, 0x2d, 0x22, 0x6f, 0xe0, 0xc5, 0x44, 0xfe, 0x18, 0xd6, 0xa2, 0x4e, 0xa0, 0x1c, 0xa4, - 0x86, 0x64, 0x1a, 0x7c, 0x02, 0xde, 0x12, 0x95, 0x61, 0x69, 0x82, 0x47, 0x63, 0x42, 0x2f, 0xcc, - 0x6a, 0x65, 0x33, 0xf6, 0x1c, 0x9f, 0x21, 0xfb, 0xca, 0xbd, 0xe4, 0x43, 0x26, 0xdf, 0x05, 0x98, - 0xfb, 0x12, 0x83, 0xbd, 0xbb, 0x88, 0xcd, 0x5f, 0x79, 0x97, 0x9c, 0x28, 0xf5, 0xcd, 0xfc, 0xa3, - 0xbd, 0x92, 0x7c, 0x7f, 0x91, 0xcc, 0xff, 0xf6, 0x76, 0x45, 0xe9, 0xf3, 0xc7, 0xe1, 0xb6, 0x0e, - 0x1b, 0xbf, 0x58, 0x87, 0xfe, 0x07, 0xee, 0x85, 0x74, 0x20, 0xb5, 0x8f, 0x25, 0xa5, 0xda, 0x6c, - 0xca, 0x8d, 0x66, 0xb5, 0xdb, 0x6a, 0x4b, 0x4a, 0xf7, 0x55, 0xa7, 0x91, 0x4b, 0xa0, 0x4d, 0xf8, - 0xb7, 0x25, 0xd5, 0x1b, 0x2f, 0x95, 0x8e, 0xdc, 0xaa, 0x35, 0xa2, 0x8a, 0x1c, 0x83, 0xb6, 0x60, - 0xf3, 0xa8, 0x5b, 0x95, 0xea, 0x55, 0xb9, 0xae, 0x1c, 0x36, 0xea, 0xad, 0xea, 0x02, 0x22, 0x97, - 0xdc, 0x7f, 0x7c, 0x76, 0xc1, 0x33, 0xe7, 0x17, 0x3c, 0xf3, 0xfd, 0x82, 0x67, 0x3e, 0x5c, 0xf2, - 0x89, 0xf3, 0x4b, 0x3e, 0xf1, 0xf9, 0x92, 0x4f, 0xbc, 0xde, 0x19, 0x68, 0xee, 0xe9, 0xf8, 0x44, - 0x54, 0x4d, 0xbd, 0xe4, 0x0c, 0x35, 0x6b, 0x57, 0x27, 0x93, 0x52, 0xf0, 0x8c, 0xbf, 0x8d, 0xfc, - 0x15, 0xe8, 0x0b, 0x70, 0xb2, 0x4c, 0x9f, 0xf0, 0x7b, 0x3f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x0c, - 0x89, 0x08, 0xe7, 0x36, 0x06, 0x00, 0x00, + // 550 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x8a, 0x13, 0x4d, + 0x14, 0xed, 0x4a, 0xf2, 0x65, 0x92, 0x9a, 0x4c, 0x92, 0xaf, 0x14, 0x69, 0x22, 0xf6, 0x34, 0xc9, + 0xa6, 0xc1, 0xb1, 0x43, 0xc6, 0x8d, 0xce, 0x32, 0x41, 0xf1, 0x87, 0xd1, 0xa1, 0x1d, 0x10, 0xdc, + 0x34, 0x95, 0x4e, 0x25, 0x53, 0x24, 0x5d, 0xd5, 0x54, 0x57, 0x1a, 0xe3, 0xca, 0x47, 0x70, 0xe9, + 0x52, 0xf0, 0x31, 0x7c, 0x81, 0x59, 0xce, 0x4a, 0x5c, 0x88, 0x48, 0x82, 0xef, 0x21, 0x5d, 0x5d, + 0xc9, 0x74, 0x20, 0xc2, 0xec, 0xee, 0xbd, 0x75, 0xea, 0xdc, 0x3a, 0xa7, 0xee, 0x85, 0x76, 0x3c, + 0xa3, 0x6c, 0xba, 0xe8, 0x86, 0x58, 0x4c, 0x89, 0x0c, 0x71, 0xd4, 0x4d, 0x7a, 0x3a, 0x71, 0x23, + 0xc1, 0x25, 0x47, 0xb7, 0x32, 0x84, 0xbb, 0x41, 0xb8, 0x49, 0xaf, 0x75, 0x7b, 0xc2, 0x27, 0x5c, + 0x9d, 0x77, 0xd3, 0x28, 0x83, 0xb6, 0x3a, 0x9a, 0x4c, 0x2e, 0x22, 0x12, 0xa7, 0x44, 0xc1, 0x5c, + 0x08, 0xc2, 0x82, 0x85, 0x1f, 0x61, 0x2a, 0x32, 0x50, 0xfb, 0x2b, 0x80, 0xe5, 0x53, 0xc5, 0x85, + 0x1e, 0xc3, 0xb2, 0xa4, 0xc1, 0x94, 0x08, 0x13, 0xd8, 0xc0, 0xd9, 0x3f, 0xbe, 0xeb, 0xee, 0xe8, + 0xe5, 0x9e, 0x2b, 0x48, 0xbf, 0x74, 0xf9, 0xeb, 0xd0, 0xf0, 0xf4, 0x05, 0x74, 0x0e, 0x9b, 0x91, + 0xe0, 0x09, 0x1d, 0x11, 0xe1, 0x07, 0x9c, 0x8d, 0xe9, 0x24, 0x36, 0x0b, 0x76, 0xd1, 0xd9, 0x3f, + 0xee, 0xec, 0x24, 0x39, 0xd3, 0xe0, 0x81, 0xc2, 0x6a, 0xb2, 0x46, 0xb4, 0x55, 0x8d, 0x4f, 0x2a, + 0x9f, 0xbf, 0x1c, 0x1a, 0x1f, 0x7f, 0xda, 0x46, 0xfb, 0x0f, 0x80, 0xe5, 0xac, 0x31, 0x7a, 0x06, + 0x0f, 0xb6, 0x74, 0xe8, 0xc7, 0xde, 0x5b, 0xf7, 0x51, 0x6a, 0xd3, 0x1e, 0x03, 0x8d, 0x3a, 0xc3, + 0x74, 0xfd, 0xdc, 0x5a, 0x90, 0xab, 0xa1, 0x16, 0xac, 0x8c, 0x48, 0x40, 0x43, 0x3c, 0x4b, 0x1f, + 0x0b, 0x9c, 0x92, 0xb7, 0xc9, 0xd1, 0x11, 0x44, 0x21, 0x65, 0x7e, 0x4e, 0xd4, 0x9c, 0x49, 0xb3, + 0xa8, 0x50, 0xcd, 0x90, 0xb2, 0x6b, 0x01, 0x73, 0x26, 0x91, 0x09, 0xf7, 0x08, 0xc3, 0xc3, 0x19, + 0x19, 0x99, 0x75, 0x1b, 0x38, 0x15, 0x6f, 0x9d, 0xa2, 0x0e, 0x3c, 0x08, 0x89, 0xc4, 0x23, 0x2c, + 0xb1, 0xff, 0xe2, 0xcd, 0xeb, 0x57, 0x66, 0xc3, 0x06, 0x4e, 0xd5, 0xab, 0xad, 0x8b, 0x69, 0x2d, + 0xa7, 0xf3, 0x3b, 0x80, 0xf5, 0x6d, 0x6f, 0x10, 0x82, 0x25, 0x86, 0x43, 0xa2, 0x64, 0x56, 0x3d, + 0x15, 0x23, 0x07, 0x36, 0xf9, 0x78, 0xec, 0x07, 0x17, 0x98, 0x32, 0x5f, 0xff, 0x59, 0x41, 0x9d, + 0xd7, 0xf9, 0x78, 0x3c, 0x48, 0xcb, 0xda, 0xad, 0xe7, 0xf0, 0x7f, 0xc6, 0x45, 0x88, 0x67, 0xf4, + 0x03, 0xf1, 0x87, 0xda, 0xb1, 0xe2, 0x0d, 0x1c, 0xf3, 0x1a, 0x9b, 0x7b, 0xfd, 0xcc, 0xae, 0x3b, + 0xb0, 0x4c, 0x59, 0x42, 0x84, 0x34, 0x4b, 0x4a, 0xa3, 0xce, 0x6e, 0x24, 0xb1, 0xfd, 0x0d, 0xc0, + 0x6a, 0x36, 0x66, 0xa7, 0x38, 0x42, 0x2f, 0xe1, 0x5e, 0x36, 0x0e, 0xb1, 0x09, 0xd4, 0x94, 0xdc, + 0xdf, 0x39, 0x25, 0x9b, 0x0b, 0x3a, 0x8a, 0x9f, 0x30, 0x29, 0x16, 0xfa, 0x2f, 0xd7, 0x0c, 0xad, + 0xb7, 0xb0, 0x96, 0x3f, 0x46, 0x4d, 0x58, 0x9c, 0x92, 0x85, 0xf6, 0x2b, 0x0d, 0x51, 0x0f, 0xfe, + 0x97, 0xe0, 0xd9, 0x9c, 0x28, 0x8f, 0xfe, 0x35, 0xd7, 0x19, 0x87, 0x97, 0x21, 0x4f, 0x0a, 0x8f, + 0xc0, 0xf5, 0xb7, 0xf4, 0x9f, 0x5e, 0x2e, 0x2d, 0x70, 0xb5, 0xb4, 0xc0, 0xef, 0xa5, 0x05, 0x3e, + 0xad, 0x2c, 0xe3, 0x6a, 0x65, 0x19, 0x3f, 0x56, 0x96, 0xf1, 0xee, 0x68, 0x42, 0xe5, 0xc5, 0x7c, + 0xe8, 0x06, 0x3c, 0xec, 0xc6, 0x53, 0x1a, 0x3d, 0x08, 0x49, 0xd2, 0xd5, 0x7b, 0xf7, 0x3e, 0xb7, + 0xc6, 0xca, 0xe3, 0x61, 0x59, 0xed, 0xdc, 0xc3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x09, 0xf7, + 0x02, 0xad, 0xe7, 0x03, 0x00, 0x00, +} + +func (m *Market) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Market) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Market) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.ProviderConfigs) > 0 { + for iNdEx := len(m.ProviderConfigs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ProviderConfigs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMarket(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Ticker.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMarket(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil } func (m *Ticker) Marshal() (dAtA []byte, err error) { @@ -632,6 +478,35 @@ func (m *ProviderConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Metadata_JSON) > 0 { + i -= len(m.Metadata_JSON) + copy(dAtA[i:], m.Metadata_JSON) + i = encodeVarintMarket(dAtA, i, uint64(len(m.Metadata_JSON))) + i-- + dAtA[i] = 0x7a + } + if m.Invert { + i-- + if m.Invert { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x20 + } + if m.NormalizeByPair != nil { + { + size, err := m.NormalizeByPair.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintMarket(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } if len(m.OffChainTicker) > 0 { i -= len(m.OffChainTicker) copy(dAtA[i:], m.OffChainTicker) @@ -649,7 +524,7 @@ func (m *ProviderConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Path) Marshal() (dAtA []byte, err error) { +func (m *MarketMap) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -659,20 +534,22 @@ func (m *Path) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Path) MarshalTo(dAtA []byte) (int, error) { +func (m *MarketMap) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Path) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MarketMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Operations) > 0 { - for iNdEx := len(m.Operations) - 1; iNdEx >= 0; iNdEx-- { + if len(m.Markets) > 0 { + for k := range m.Markets { + v := m.Markets[k] + baseI := i { - size, err := m.Operations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -680,247 +557,48 @@ func (m *Path) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintMarket(dAtA, i, uint64(size)) } i-- + dAtA[i] = 0x12 + i -= len(k) + copy(dAtA[i:], k) + i = encodeVarintMarket(dAtA, i, uint64(len(k))) + i-- + dAtA[i] = 0xa + i = encodeVarintMarket(dAtA, i, uint64(baseI-i)) + i-- dAtA[i] = 0xa } } return len(dAtA) - i, nil } -func (m *Operation) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintMarket(dAtA []byte, offset int, v uint64) int { + offset -= sovMarket(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *Operation) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *Operation) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *Market) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.Provider) > 0 { - i -= len(m.Provider) - copy(dAtA[i:], m.Provider) - i = encodeVarintMarket(dAtA, i, uint64(len(m.Provider))) - i-- - dAtA[i] = 0x1a - } - if m.Invert { - i-- - if m.Invert { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x10 - } - { - size, err := m.CurrencyPair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Paths) 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 *Paths) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Paths) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Paths) > 0 { - for iNdEx := len(m.Paths) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Paths[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *Providers) 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 *Providers) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Providers) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Providers) > 0 { - for iNdEx := len(m.Providers) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Providers[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MarketMap) 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 *MarketMap) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MarketMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.AggregationType != 0 { - i = encodeVarintMarket(dAtA, i, uint64(m.AggregationType)) - i-- - dAtA[i] = 0x20 - } - if len(m.Providers) > 0 { - for k := range m.Providers { - v := m.Providers[k] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintMarket(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintMarket(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x1a - } - } - if len(m.Paths) > 0 { - for k := range m.Paths { - v := m.Paths[k] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintMarket(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintMarket(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0x12 - } - } - if len(m.Tickers) > 0 { - for k := range m.Tickers { - v := m.Tickers[k] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintMarket(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintMarket(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa + l = m.Ticker.Size() + n += 1 + l + sovMarket(uint64(l)) + if len(m.ProviderConfigs) > 0 { + for _, e := range m.ProviderConfigs { + l = e.Size() + n += 1 + l + sovMarket(uint64(l)) } } - return len(dAtA) - i, nil + return n } -func encodeVarintMarket(dAtA []byte, offset int, v uint64) int { - offset -= sovMarket(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} func (m *Ticker) Size() (n int) { if m == nil { return 0 @@ -959,624 +637,45 @@ func (m *ProviderConfig) Size() (n int) { if l > 0 { n += 1 + l + sovMarket(uint64(l)) } - return n -} - -func (m *Path) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Operations) > 0 { - for _, e := range m.Operations { - l = e.Size() - n += 1 + l + sovMarket(uint64(l)) - } - } - return n -} - -func (m *Operation) Size() (n int) { - if m == nil { - return 0 + if m.NormalizeByPair != nil { + l = m.NormalizeByPair.Size() + n += 1 + l + sovMarket(uint64(l)) } - var l int - _ = l - l = m.CurrencyPair.Size() - n += 1 + l + sovMarket(uint64(l)) if m.Invert { n += 2 } - l = len(m.Provider) + l = len(m.Metadata_JSON) if l > 0 { n += 1 + l + sovMarket(uint64(l)) } return n } -func (m *Paths) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Paths) > 0 { - for _, e := range m.Paths { - l = e.Size() - n += 1 + l + sovMarket(uint64(l)) - } - } - return n -} - -func (m *Providers) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Providers) > 0 { - for _, e := range m.Providers { - l = e.Size() - n += 1 + l + sovMarket(uint64(l)) - } - } - return n -} - func (m *MarketMap) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.Tickers) > 0 { - for k, v := range m.Tickers { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovMarket(uint64(len(k))) + 1 + l + sovMarket(uint64(l)) - n += mapEntrySize + 1 + sovMarket(uint64(mapEntrySize)) - } - } - if len(m.Paths) > 0 { - for k, v := range m.Paths { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovMarket(uint64(len(k))) + 1 + l + sovMarket(uint64(l)) - n += mapEntrySize + 1 + sovMarket(uint64(mapEntrySize)) - } - } - if len(m.Providers) > 0 { - for k, v := range m.Providers { + if len(m.Markets) > 0 { + for k, v := range m.Markets { _ = k _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovMarket(uint64(len(k))) + 1 + l + sovMarket(uint64(l)) - n += mapEntrySize + 1 + sovMarket(uint64(mapEntrySize)) - } - } - if m.AggregationType != 0 { - n += 1 + sovMarket(uint64(m.AggregationType)) - } - return n -} - -func sovMarket(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMarket(x uint64) (n int) { - return sovMarket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Ticker) 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 ErrIntOverflowMarket - } - 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: Ticker: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Ticker: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) - } - m.Decimals = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Decimals |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinProviderCount", wireType) - } - m.MinProviderCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinProviderCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata_JSON = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProviderConfig) 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 ErrIntOverflowMarket - } - 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: ProviderConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProviderConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OffChainTicker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OffChainTicker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Path) 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 ErrIntOverflowMarket - } - 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: Path: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Path: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Operations", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Operations = append(m.Operations, Operation{}) - if err := m.Operations[len(m.Operations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Operation) 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 ErrIntOverflowMarket - } - 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: Operation: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Operation: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Invert", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Invert = bool(v != 0) - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Provider = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + l = v.Size() + mapEntrySize := 1 + len(k) + sovMarket(uint64(len(k))) + 1 + l + sovMarket(uint64(l)) + n += mapEntrySize + 1 + sovMarket(uint64(mapEntrySize)) } } + return n +} - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func sovMarket(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozMarket(x uint64) (n int) { + return sovMarket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *Paths) Unmarshal(dAtA []byte) error { +func (m *Market) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1599,15 +698,48 @@ func (m *Paths) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Paths: wiretype end group for non-group") + return fmt.Errorf("proto: Market: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Paths: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Market: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthMarket + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthMarket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Ticker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ProviderConfigs", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1634,8 +766,8 @@ func (m *Paths) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Paths = append(m.Paths, Path{}) - if err := m.Paths[len(m.Paths)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ProviderConfigs = append(m.ProviderConfigs, ProviderConfig{}) + if err := m.ProviderConfigs[len(m.ProviderConfigs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1660,7 +792,7 @@ func (m *Paths) Unmarshal(dAtA []byte) error { } return nil } -func (m *Providers) Unmarshal(dAtA []byte) error { +func (m *Ticker) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1683,15 +815,15 @@ func (m *Providers) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Providers: wiretype end group for non-group") + return fmt.Errorf("proto: Ticker: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Providers: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Ticker: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1718,11 +850,100 @@ func (m *Providers) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Providers = append(m.Providers, ProviderConfig{}) - if err := m.Providers[len(m.Providers)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) + } + m.Decimals = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Decimals |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MinProviderCount", wireType) + } + m.MinProviderCount = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MinProviderCount |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Enabled = bool(v != 0) + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + 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 ErrInvalidLengthMarket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMarket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata_JSON = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipMarket(dAtA[iNdEx:]) @@ -1744,7 +965,7 @@ func (m *Providers) Unmarshal(dAtA []byte) error { } return nil } -func (m *MarketMap) Unmarshal(dAtA []byte) error { +func (m *ProviderConfig) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1767,17 +988,17 @@ func (m *MarketMap) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MarketMap: wiretype end group for non-group") + return fmt.Errorf("proto: ProviderConfig: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MarketMap: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ProviderConfig: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Tickers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowMarket @@ -1787,124 +1008,59 @@ func (m *MarketMap) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Tickers == nil { - m.Tickers = make(map[string]Ticker) - } - var mapkey string - mapvalue := &Ticker{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthMarket - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthMarket - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthMarket - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthMarket - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &Ticker{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } - m.Tickers[mapkey] = *mapvalue + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMarket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMarket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OffChainTicker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + 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 ErrInvalidLengthMarket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMarket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OffChainTicker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field NormalizeByPair", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -1931,109 +1087,118 @@ func (m *MarketMap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Paths == nil { - m.Paths = make(map[string]Paths) + if m.NormalizeByPair == nil { + m.NormalizeByPair = &types.CurrencyPair{} } - var mapkey string - mapvalue := &Paths{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } + if err := m.NormalizeByPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Invert", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthMarket - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthMarket - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthMarket - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthMarket - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &Paths{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.Invert = bool(v != 0) + case 15: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowMarket + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break } } - m.Paths[mapkey] = *mapvalue + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthMarket + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthMarket + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Metadata_JSON = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + default: + iNdEx = preIndex + skippy, err := skipMarket(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthMarket + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MarketMap) 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 ErrIntOverflowMarket + } + 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: MarketMap: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MarketMap: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -2060,11 +1225,11 @@ func (m *MarketMap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.Providers == nil { - m.Providers = make(map[string]Providers) + if m.Markets == nil { + m.Markets = make(map[string]Market) } var mapkey string - mapvalue := &Providers{} + mapvalue := &Market{} for iNdEx < postIndex { entryPreIndex := iNdEx var wire uint64 @@ -2138,7 +1303,7 @@ func (m *MarketMap) Unmarshal(dAtA []byte) error { if postmsgIndex > l { return io.ErrUnexpectedEOF } - mapvalue = &Providers{} + mapvalue = &Market{} if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { return err } @@ -2158,27 +1323,8 @@ func (m *MarketMap) Unmarshal(dAtA []byte) error { iNdEx += skippy } } - m.Providers[mapkey] = *mapvalue + m.Markets[mapkey] = *mapvalue iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregationType", wireType) - } - m.AggregationType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.AggregationType |= AggregationType(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipMarket(dAtA[iNdEx:]) diff --git a/x/marketmap/types/market_test.go b/x/marketmap/types/market_test.go index b077da4bd..615725932 100644 --- a/x/marketmap/types/market_test.go +++ b/x/marketmap/types/market_test.go @@ -6,157 +6,160 @@ import ( "github.com/stretchr/testify/require" "github.com/skip-mev/slinky/oracle/constants" + slinkytypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/providers/apis/coinbase" "github.com/skip-mev/slinky/x/marketmap/types" ) -func TestMarketMapValidateBasic(t *testing.T) { - testCases := []struct { - name string - marketMap types.MarketMap - expectErr bool - }{ - { - name: "valid empty", - marketMap: types.MarketMap{}, - expectErr: false, +var ( + btcusdt = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "BITCOIN", + Quote: "USDT", + }, + Decimals: 8, + MinProviderCount: 1, }, - { - name: "valid map", - marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-usdt", }, - expectErr: false, }, - { - name: "invalid mismatch ticker", - marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - usdtusd.String(): usdtusdProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, + } + + btcusd = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "BITCOIN", + Quote: "USD", }, - expectErr: true, + Decimals: 8, + MinProviderCount: 1, }, - { - name: "invalid ticker does not exist for a given provider", - marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-usdt", + NormalizeByPair: &usdtusd.Ticker.CurrencyPair, }, - expectErr: true, }, - { - name: "invalid ticker string does not match ticker ID", - marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - "invalid": ethusdt, - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - }, + } + + usdtusd = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "USDT", + Quote: "USD", + }, + Decimals: 8, + MinProviderCount: 1, + }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "usdt-usd", }, - expectErr: true, }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.marketMap.ValidateBasic() - if tc.expectErr { - require.Error(t, err) - return - } + usdcusd = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "USDC", + Quote: "USD", + }, + Decimals: 8, + MinProviderCount: 1, + }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "usdc-usd", + }, + }, + } - require.NoError(t, err) - }) + ethusdt = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "ETHEREUM", + Quote: "USDT", + }, + Decimals: 8, + MinProviderCount: 1, + }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "eth-usdt", + }, + }, } -} -func TestValidateMarketMap(t *testing.T) { + ethusd = types.Market{ + Ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "ETHEREUM", + Quote: "USD", + }, + Decimals: 8, + MinProviderCount: 3, + }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "eth-usdt", + NormalizeByPair: &usdtusd.Ticker.CurrencyPair, + }, + { + Name: "binance", + OffChainTicker: "eth-usdt", + NormalizeByPair: &usdtusd.Ticker.CurrencyPair, + }, + { + Name: "mexc", + OffChainTicker: "eth-usdt", + NormalizeByPair: &usdtusd.Ticker.CurrencyPair, + }, + }, + } + + markets = map[string]types.Market{ + btcusdt.Ticker.String(): btcusdt, + btcusd.Ticker.String(): btcusd, + usdtusd.Ticker.String(): usdtusd, + usdcusd.Ticker.String(): usdcusd, + ethusdt.Ticker.String(): ethusdt, + ethusd.Ticker.String(): ethusd, + } +) + +func TestMarketMapValidateBasic(t *testing.T) { testCases := []struct { - name string - cfg types.MarketMap - err bool + name string + marketMap types.MarketMap + expectErr bool }{ { - name: "empty market map", - cfg: types.MarketMap{ - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, - }, - err: false, + name: "valid empty", + marketMap: types.MarketMap{}, + expectErr: false, }, { - name: "provider includes a ticker that is not supported by the main set", - cfg: types.MarketMap{ - Providers: map[string]types.Providers{ - constants.BITCOIN_USD.String(): { - Providers: []types.ProviderConfig{ - { - Name: coinbase.Name, - OffChainTicker: "BTC-USD", - }, - }, - }, - }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, + name: "valid map", + marketMap: types.MarketMap{ + Markets: markets, }, - err: true, + expectErr: false, }, { - name: "provider includes a ticker that is supported by the main set - no paths", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]types.Providers{ + name: "market with no ticker", + marketMap: types.MarketMap{ + Markets: map[string]types.Market{ constants.BITCOIN_USD.String(): { - Providers: []types.ProviderConfig{ + ProviderConfigs: []types.ProviderConfig{ { Name: coinbase.Name, OffChainTicker: "BTC-USD", @@ -164,267 +167,108 @@ func TestValidateMarketMap(t *testing.T) { }, }, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, - err: false, + expectErr: true, }, { - name: "path includes a ticker that is not supported", - cfg: types.MarketMap{ - Paths: map[string]types.Paths{ + name: "empty market", + marketMap: types.MarketMap{ + Markets: map[string]types.Market{ constants.BITCOIN_USD.String(): {}, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, - err: true, - }, - { - name: "paths includes a path that has no operations", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Paths: map[string]types.Paths{ - constants.BITCOIN_USD.String(): { - Paths: []types.Path{ - { - Operations: []types.Operation{}, - }, - }, - }, - }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, - }, - err: true, + expectErr: true, }, { - name: "paths includes a path that has too many operations", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Paths: map[string]types.Paths{ + name: "provider config includes a ticker that is not supported", + marketMap: types.MarketMap{ + Markets: map[string]types.Market{ constants.BITCOIN_USD.String(): { - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Provider: coinbase.Name, - }, - { - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Provider: coinbase.Name, - }, - { - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Provider: coinbase.Name, - }, - }, - }, + Ticker: types.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, + MinProviderCount: 1, }, - }, - }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, - }, - err: true, - }, - { - name: "operation includes a ticker that is not supported", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Paths: map[string]types.Paths{ - constants.BITCOIN_USD.String(): { - Paths: []types.Path{ + ProviderConfigs: []types.ProviderConfig{ { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USDT.CurrencyPair, - Provider: coinbase.Name, - }, - }, + Name: coinbase.Name, + OffChainTicker: "btc-usd", + NormalizeByPair: &slinkytypes.CurrencyPair{Base: "not", Quote: "real"}, + Invert: false, + Metadata_JSON: "", }, }, }, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, - err: true, + expectErr: true, }, { - name: "operation includes a provider that does not support the ticker", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Paths: map[string]types.Paths{ + name: "empty provider name", + marketMap: types.MarketMap{ + Markets: map[string]types.Market{ constants.BITCOIN_USD.String(): { - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Provider: coinbase.Name, - }, - }, - }, + Ticker: types.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, + MinProviderCount: 1, }, - }, - }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, - }, - err: true, - }, - { - name: "provider does not support a ticker included in an operation", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]types.Providers{ - constants.BITCOIN_USD.String(): { - Providers: []types.ProviderConfig{}, - }, - }, - Paths: map[string]types.Paths{ - constants.BITCOIN_USD.String(): { - Paths: []types.Path{ + ProviderConfigs: []types.ProviderConfig{ { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Provider: coinbase.Name, - }, - }, + Name: "", + OffChainTicker: "btc-usd", + Invert: false, + Metadata_JSON: "", }, }, }, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, - err: true, + expectErr: true, }, { - name: "valid single path", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]types.Providers{ - constants.BITCOIN_USD.String(): { - Providers: []types.ProviderConfig{ - { - Name: coinbase.Name, - OffChainTicker: "BTC-USD", - }, - }, - }, - }, - Paths: map[string]types.Paths{ + name: "no provider configs", + marketMap: types.MarketMap{ + Markets: map[string]types.Market{ constants.BITCOIN_USD.String(): { - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USD.CurrencyPair, - Provider: coinbase.Name, - }, - }, - }, + Ticker: types.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, + MinProviderCount: 1, }, + ProviderConfigs: []types.ProviderConfig{}, }, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, - err: false, + expectErr: true, }, { - name: "path includes a index ticker that is not supported", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USDT.String(): constants.BITCOIN_USDT, - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - }, - Providers: map[string]types.Providers{ - constants.BITCOIN_USDT.String(): { - Providers: []types.ProviderConfig{ - { - Name: coinbase.Name, - OffChainTicker: "BTC-USDT", - }, - }, - }, - }, - Paths: map[string]types.Paths{ + name: "valid single provider", + marketMap: types.MarketMap{ + Markets: map[string]types.Market{ constants.BITCOIN_USD.String(): { - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USDT.CurrencyPair, - Provider: coinbase.Name, - }, - { - CurrencyPair: constants.USDT_USD.CurrencyPair, - Provider: types.IndexPrice, - }, - }, - }, + Ticker: types.Ticker{ + CurrencyPair: constants.BITCOIN_USD, + Decimals: 8, + MinProviderCount: 1, }, - }, - }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, - }, - err: true, - }, - { - name: "second operation is not an index price provider", - cfg: types.MarketMap{ - Tickers: map[string]types.Ticker{ - constants.BITCOIN_USDT.String(): constants.BITCOIN_USDT, - constants.BITCOIN_USD.String(): constants.BITCOIN_USD, - constants.USDT_USD.String(): constants.USDT_USD, - }, - Providers: map[string]types.Providers{ - constants.BITCOIN_USDT.String(): { - Providers: []types.ProviderConfig{ + ProviderConfigs: []types.ProviderConfig{ { Name: coinbase.Name, - OffChainTicker: "BTC-USDT", - }, - }, - }, - }, - Paths: map[string]types.Paths{ - constants.BITCOIN_USD.String(): { - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: constants.BITCOIN_USDT.CurrencyPair, - Provider: coinbase.Name, - }, - { - CurrencyPair: constants.USDT_USD.CurrencyPair, - Provider: coinbase.Name, - }, - }, + OffChainTicker: "BTC-USD", }, }, }, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, - err: true, + expectErr: false, }, } for _, tc := range testCases { t.Run(tc.name, func(t *testing.T) { - err := tc.cfg.ValidateBasic() - if tc.err { + err := tc.marketMap.ValidateBasic() + if tc.expectErr { require.Error(t, err) } else { require.NoError(t, err) @@ -449,25 +293,13 @@ func TestMarketMapEqual(t *testing.T) { { name: "same market map", marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, + Markets: map[string]types.Market{ + ethusdt.Ticker.String(): ethusdt, }, }, other: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, + Markets: map[string]types.Market{ + ethusdt.Ticker.String(): ethusdt, }, }, expect: true, @@ -475,51 +307,13 @@ func TestMarketMapEqual(t *testing.T) { { name: "different tickers", marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - }, - }, - other: types.MarketMap{ - Tickers: map[string]types.Ticker{ - btcusdt.String(): btcusdt, - }, - Paths: map[string]types.Paths{ - btcusdt.String(): btcusdtPaths, - }, - Providers: map[string]types.Providers{ - btcusdt.String(): btcusdtProviders, - }, - }, - expect: false, - }, - { - name: "different paths", - marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, + Markets: map[string]types.Market{ + ethusdt.Ticker.String(): ethusdt, }, }, other: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - btcusdt.String(): btcusdtPaths, - }, - Providers: map[string]types.Providers{ - btcusdt.String(): btcusdtProviders, + Markets: map[string]types.Market{ + btcusdt.Ticker.String(): btcusdt, }, }, expect: false, @@ -527,53 +321,16 @@ func TestMarketMapEqual(t *testing.T) { { name: "different providers", marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, - }, - }, - other: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - btcusdt.String(): btcusdtProviders, - }, - }, - expect: false, - }, - - { - name: "different aggregation type", - marketMap: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, + Markets: map[string]types.Market{ + ethusdt.Ticker.String(): ethusdt, }, - AggregationType: types.AggregationType_INDEX_PRICE_AGGREGATION, }, other: types.MarketMap{ - Tickers: map[string]types.Ticker{ - ethusdt.String(): ethusdt, - }, - Paths: map[string]types.Paths{ - ethusdt.String(): ethusdtPaths, - }, - Providers: map[string]types.Providers{ - ethusdt.String(): ethusdtProviders, + Markets: map[string]types.Market{ + ethusdt.Ticker.String(): { + Ticker: ethusdt.Ticker, + ProviderConfigs: btcusdt.ProviderConfigs, + }, }, }, expect: false, diff --git a/x/marketmap/types/msg.go b/x/marketmap/types/msg.go index fe57efaac..b68120334 100644 --- a/x/marketmap/types/msg.go +++ b/x/marketmap/types/msg.go @@ -7,48 +7,88 @@ import ( ) var ( - _ sdk.Msg = &MsgUpdateMarketMap{} + _ sdk.Msg = &MsgCreateMarkets{} + _ sdk.Msg = &MsgUpdateMarkets{} _ sdk.Msg = &MsgParams{} + _ sdk.Msg = &MsgRemoveMarketAuthorities{} ) // ValidateBasic determines whether the information in the message is formatted correctly, specifically // whether the signer is a valid acc-address. -func (m *MsgUpdateMarketMap) ValidateBasic() error { +func (m *MsgCreateMarkets) ValidateBasic() error { // validate signer address - if _, err := sdk.AccAddressFromBech32(m.Signer); err != nil { + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { return err } + if len(m.CreateMarkets) == 0 { + return fmt.Errorf("no markets to create") + } + for _, market := range m.CreateMarkets { - if err := market.Ticker.ValidateBasic(); err != nil { + if err := market.ValidateBasic(); err != nil { return err } + } + + return nil +} + +// ValidateBasic determines whether the information in the message is formatted correctly, specifically +// whether the signer is a valid acc-address. +func (m *MsgUpdateMarkets) ValidateBasic() error { + // validate signer address + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return err + } + + if len(m.UpdateMarkets) == 0 { + return fmt.Errorf("no markets to update") + } - for _, path := range market.Paths.Paths { - if err := path.ValidateBasic(); err != nil { - return err - } + for _, market := range m.UpdateMarkets { + if err := market.ValidateBasic(); err != nil { + return err } + } + + return nil +} + +// ValidateBasic determines whether the information in the message is formatted correctly, specifically +// whether the signer is a valid acc-address. +func (m *MsgParams) ValidateBasic() error { + // validate signer address + if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { + return err + } + + return m.Params.ValidateBasic() +} - if uint64(len(market.Providers.Providers)) < market.Ticker.MinProviderCount { - return fmt.Errorf("this ticker must have at least %d providers; got %d", - market.Ticker.MinProviderCount, - len(market.Providers.Providers), - ) +// ValidateBasic determines whether the information in the message is formatted correctly, specifically +// whether the signer is a valid acc-address. +func (m *MsgRemoveMarketAuthorities) ValidateBasic() error { + // validate signer address + if _, err := sdk.AccAddressFromBech32(m.Admin); err != nil { + return err + } + + if len(m.RemoveAddresses) == 0 { + return fmt.Errorf("addresses to remove cannot be nil") + } + + seenAuthorities := make(map[string]struct{}, len(m.RemoveAddresses)) + for _, authority := range m.RemoveAddresses { + if _, seen := seenAuthorities[authority]; seen { + return fmt.Errorf("duplicate address %s found", authority) } - seenProviders := make(map[string]struct{}, len(market.Providers.Providers)) - for _, provider := range market.Providers.Providers { - if err := provider.ValidateBasic(); err != nil { - return err - } - - // check for duplicate providers - if _, seen := seenProviders[provider.Name]; seen { - return fmt.Errorf("duplicate provider found: %s", provider.Name) - } - seenProviders[provider.Name] = struct{}{} + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + return fmt.Errorf("invalid market authority string: %w", err) } + + seenAuthorities[authority] = struct{}{} } return nil diff --git a/x/marketmap/types/msg_test.go b/x/marketmap/types/msg_test.go index 60d603cc8..0c3beeb8a 100644 --- a/x/marketmap/types/msg_test.go +++ b/x/marketmap/types/msg_test.go @@ -24,49 +24,42 @@ func TestValidateBasicMsgCreateMarket(t *testing.T) { tcs := []struct { name string - msg types.MsgUpdateMarketMap + msg types.MsgCreateMarkets expectPass bool }{ { - "if the signer is not an acc-address - fail", - types.MsgUpdateMarketMap{ - Signer: "invalid", + "if the authority is not an acc-address - fail", + types.MsgCreateMarkets{ + Authority: "invalid", }, false, }, { - "invalid ticker - fail", - types.MsgUpdateMarketMap{ - Signer: sample.Address(sample.Rand()), - CreateMarkets: []types.CreateMarket{ + "if there are no creates - fail", + types.MsgCreateMarkets{ + Authority: sample.Address(sample.Rand()), + }, + false, + }, + { + "invalid ticker (0 decimals) - fail", + types.MsgCreateMarkets{ + Authority: sample.Address(sample.Rand()), + CreateMarkets: []types.Market{ { Ticker: types.Ticker{ CurrencyPair: validCurrencyPair, Decimals: 0, MinProviderCount: 0, }, - Providers: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "btceth", - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", }, - }, - Paths: types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: validTicker.CurrencyPair, - Invert: false, - }, - }, - }, + { + Name: "mexc", + OffChainTicker: "btceth", }, }, }, @@ -75,30 +68,38 @@ func TestValidateBasicMsgCreateMarket(t *testing.T) { false, }, { - "invalid num providers - fail", - types.MsgUpdateMarketMap{ - Signer: sample.Address(sample.Rand()), - CreateMarkets: []types.CreateMarket{ + "invalid num providers (need more than 1) - fail", + types.MsgCreateMarkets{ + Authority: sample.Address(sample.Rand()), + CreateMarkets: []types.Market{ { Ticker: validTicker, - Providers: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", }, }, - Paths: types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: validTicker.CurrencyPair, - Invert: false, - }, - }, - }, + }, + }, + }, + false, + }, + { + "invalid empty off-chain ticker - fail", + types.MsgCreateMarkets{ + Authority: sample.Address(sample.Rand()), + CreateMarkets: []types.Market{ + { + Ticker: validTicker, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", + }, + { + Name: "mexc", + OffChainTicker: "", }, }, }, @@ -107,34 +108,91 @@ func TestValidateBasicMsgCreateMarket(t *testing.T) { false, }, { - "invalid empty offchain ticker - fail", - types.MsgUpdateMarketMap{ - Signer: sample.Address(sample.Rand()), - CreateMarkets: []types.CreateMarket{ + "valid message", + types.MsgCreateMarkets{ + Authority: sample.Address(sample.Rand()), + CreateMarkets: []types.Market{ { Ticker: validTicker, - Providers: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "", - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", + }, + { + Name: "mexc", + OffChainTicker: "btceth", }, }, - Paths: types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: validTicker.CurrencyPair, - Invert: false, - }, - }, - }, + }, + }, + }, + true, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if !tc.expectPass { + require.NotNil(t, err) + } else { + require.Nil(t, err) + } + }) + } +} + +func TestValidateBasicMsgUpdateMarket(t *testing.T) { + validCurrencyPair := slinkytypes.CurrencyPair{ + Base: "BTC", + Quote: "ETH", + } + + validTicker := types.Ticker{ + CurrencyPair: validCurrencyPair, + Decimals: 8, + MinProviderCount: 2, + } + + tcs := []struct { + name string + msg types.MsgUpdateMarkets + expectPass bool + }{ + { + "if the Authority is not an acc-address - fail", + types.MsgUpdateMarkets{ + Authority: "invalid", + }, + false, + }, + { + "if there are no creates - fail", + types.MsgUpdateMarkets{ + Authority: sample.Address(sample.Rand()), + }, + false, + }, + { + "invalid ticker (decimals) - fail", + types.MsgUpdateMarkets{ + Authority: sample.Address(sample.Rand()), + UpdateMarkets: []types.Market{ + { + Ticker: types.Ticker{ + CurrencyPair: validCurrencyPair, + Decimals: 0, + MinProviderCount: 0, + }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", + }, + { + Name: "mexc", + OffChainTicker: "btceth", }, }, }, @@ -143,51 +201,39 @@ func TestValidateBasicMsgCreateMarket(t *testing.T) { false, }, { - "invalid no paths - fail", - types.MsgUpdateMarketMap{ - Signer: sample.Address(sample.Rand()), - CreateMarkets: []types.CreateMarket{ + "invalid num providers (need more than 1) - fail", + types.MsgUpdateMarkets{ + Authority: sample.Address(sample.Rand()), + UpdateMarkets: []types.Market{ { Ticker: validTicker, - Providers: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "", - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", }, }, - Paths: types.Paths{}, }, }, }, false, }, { - "invalid path - fail", - types.MsgUpdateMarketMap{ - Signer: sample.Address(sample.Rand()), - CreateMarkets: []types.CreateMarket{ + "invalid empty offchain ticker - fail", + types.MsgUpdateMarkets{ + Authority: sample.Address(sample.Rand()), + UpdateMarkets: []types.Market{ { Ticker: validTicker, - Providers: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "", - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", + }, + { + Name: "mexc", + OffChainTicker: "", }, - }, - Paths: types.Paths{ - Paths: make([]types.Path, 0), }, }, }, @@ -196,33 +242,19 @@ func TestValidateBasicMsgCreateMarket(t *testing.T) { }, { "valid message", - types.MsgUpdateMarketMap{ - Signer: sample.Address(sample.Rand()), - CreateMarkets: []types.CreateMarket{ + types.MsgUpdateMarkets{ + Authority: sample.Address(sample.Rand()), + UpdateMarkets: []types.Market{ { Ticker: validTicker, - Providers: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "btceth", - }, + ProviderConfigs: []types.ProviderConfig{ + { + Name: "kucoin", + OffChainTicker: "btc-eth", }, - }, - Paths: types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: validTicker.CurrencyPair, - Invert: false, - }, - }, - }, + { + Name: "mexc", + OffChainTicker: "btceth", }, }, }, @@ -243,3 +275,108 @@ func TestValidateBasicMsgCreateMarket(t *testing.T) { }) } } + +func TestValidateBasicMsgParams(t *testing.T) { + rng := sample.Rand() + + tcs := []struct { + name string + msg types.MsgParams + expectPass bool + }{ + { + "if the Authority is not an acc-address - fail", + types.MsgParams{ + Authority: "invalid", + }, + false, + }, + { + name: "invalid params (no authorities) - fail", + msg: types.MsgParams{ + Params: types.Params{ + MarketAuthorities: nil, + }, + Authority: sample.Address(rng), + }, + expectPass: false, + }, + { + name: "valid params", + msg: types.MsgParams{ + Params: types.Params{ + MarketAuthorities: []string{sample.Address(rng)}, + Admin: sample.Address(rng), + }, + Authority: sample.Address(rng), + }, + expectPass: true, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if !tc.expectPass { + require.NotNil(t, err) + } else { + require.Nil(t, err) + } + }) + } +} + +func TestValidateBasicMsgRemoveMarketAuthorities(t *testing.T) { + rng := sample.Rand() + + sampleAuth := sample.Address(rng) + + tcs := []struct { + name string + msg types.MsgRemoveMarketAuthorities + expectPass bool + }{ + { + "if the Admin is not an acc-address - fail", + types.MsgRemoveMarketAuthorities{ + Admin: "invalid", + }, + false, + }, + { + name: "invalid message (no authorities) - fail", + msg: types.MsgRemoveMarketAuthorities{ + RemoveAddresses: nil, + Admin: sample.Address(rng), + }, + expectPass: false, + }, + { + name: "valid message", + msg: types.MsgRemoveMarketAuthorities{ + RemoveAddresses: []string{sample.Address(rng)}, + Admin: sample.Address(rng), + }, + expectPass: true, + }, + { + name: "invalid message (duplicate authorities", + msg: types.MsgRemoveMarketAuthorities{ + RemoveAddresses: []string{sampleAuth, sampleAuth}, + Admin: sample.Address(rng), + }, + expectPass: false, + }, + } + + for _, tc := range tcs { + t.Run(tc.name, func(t *testing.T) { + err := tc.msg.ValidateBasic() + if !tc.expectPass { + require.NotNil(t, err) + } else { + require.Nil(t, err) + } + }) + } +} diff --git a/x/marketmap/types/params.go b/x/marketmap/types/params.go index 5ce0560eb..adcc93bcc 100644 --- a/x/marketmap/types/params.go +++ b/x/marketmap/types/params.go @@ -8,34 +8,54 @@ import ( govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" ) -const ( - // DefaultVersion is the default value for the Version Param. - DefaultVersion = 0 +var ( + // DefaultMarketAuthority is the default value for the market authority Param. + DefaultMarketAuthority = authtypes.NewModuleAddress(govtypes.ModuleName).String() + // DefaultAdmin is the default value for the market admin Param. + DefaultAdmin = authtypes.NewModuleAddress(govtypes.ModuleName).String() ) -// DefaultMarketAuthority is the default value for the market authority Param. -var DefaultMarketAuthority = authtypes.NewModuleAddress(govtypes.ModuleName).String() - // DefaultParams returns default marketmap parameters. func DefaultParams() Params { return Params{ - MarketAuthority: DefaultMarketAuthority, - Version: DefaultVersion, + MarketAuthorities: []string{DefaultMarketAuthority}, + Admin: DefaultAdmin, } } // NewParams returns a new Params instance. -func NewParams(authority string, version uint64) Params { - return Params{ - MarketAuthority: authority, - Version: version, +func NewParams(authorities []string, admin string) (Params, error) { + if authorities == nil { + return Params{}, fmt.Errorf("cannot create Params with nil authority") } + + return Params{ + MarketAuthorities: authorities, + Admin: admin, + }, nil } // ValidateBasic performs stateless validation of the Params. func (p *Params) ValidateBasic() error { - if _, err := sdk.AccAddressFromBech32(p.MarketAuthority); err != nil { - return fmt.Errorf("invalid market authority string: %w", err) + if p.MarketAuthorities == nil { + return fmt.Errorf("cannot create Params with empty market authorities") + } + + seenAuthorities := make(map[string]struct{}, len(p.MarketAuthorities)) + for _, authority := range p.MarketAuthorities { + if _, seen := seenAuthorities[authority]; seen { + return fmt.Errorf("duplicate authority %s found", authority) + } + + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + return fmt.Errorf("invalid market authority string: %w", err) + } + + seenAuthorities[authority] = struct{}{} + } + + if _, err := sdk.AccAddressFromBech32(p.Admin); err != nil { + return fmt.Errorf("invalid marketmap admin string: %w", err) } return nil diff --git a/x/marketmap/types/params.pb.go b/x/marketmap/types/params.pb.go index 6b7239ea2..9fe5a12be 100644 --- a/x/marketmap/types/params.pb.go +++ b/x/marketmap/types/params.pb.go @@ -24,12 +24,12 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the x/marketmap module. type Params struct { - // MarketAuthority is the authority account that is able to control updating - // the marketmap. - MarketAuthority string `protobuf:"bytes,1,opt,name=market_authority,json=marketAuthority,proto3" json:"market_authority,omitempty"` - // Version is the schema version for the MarketMap data structure and query - // response. - Version uint64 `protobuf:"varint,2,opt,name=version,proto3" json:"version,omitempty"` + // MarketAuthorities is the list of authority accounts that are able to + // control updating the marketmap. + MarketAuthorities []string `protobuf:"bytes,1,rep,name=market_authorities,json=marketAuthorities,proto3" json:"market_authorities,omitempty"` + // Admin is an address that can remove addresses from the MarketAuthorities + // list. Only governance can add to the MarketAuthorities or change the Admin. + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -65,18 +65,18 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetMarketAuthority() string { +func (m *Params) GetMarketAuthorities() []string { if m != nil { - return m.MarketAuthority + return m.MarketAuthorities } - return "" + return nil } -func (m *Params) GetVersion() uint64 { +func (m *Params) GetAdmin() string { if m != nil { - return m.Version + return m.Admin } - return 0 + return "" } func init() { @@ -90,15 +90,15 @@ var fileDescriptor_ee4934564ff92a6f = []byte{ 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xce, 0xc9, 0xcc, 0xcb, 0xae, 0xd4, 0xcf, 0x4d, 0x2c, 0xca, 0x4e, 0x2d, 0xc9, 0x4d, 0x2c, 0xd0, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x86, 0xa8, - 0xd0, 0x83, 0xab, 0xd0, 0x2b, 0x33, 0x54, 0xf2, 0xe5, 0x62, 0x0b, 0x00, 0x2b, 0x12, 0xd2, 0xe4, - 0x12, 0x80, 0xc8, 0xc4, 0x27, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x54, 0x4a, 0x30, 0x2a, - 0x30, 0x6a, 0x70, 0x06, 0xf1, 0x43, 0xc4, 0x1d, 0x61, 0xc2, 0x42, 0x12, 0x5c, 0xec, 0x65, 0xa9, - 0x45, 0xc5, 0x99, 0xf9, 0x79, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x2c, 0x41, 0x30, 0xae, 0x93, 0xdb, + 0xd0, 0x83, 0xab, 0xd0, 0x2b, 0x33, 0x54, 0xf2, 0xe5, 0x62, 0x0b, 0x00, 0x2b, 0x12, 0xd2, 0xe5, + 0x12, 0x82, 0xc8, 0xc4, 0x27, 0x96, 0x96, 0x64, 0xe4, 0x17, 0x65, 0x96, 0x64, 0xa6, 0x16, 0x4b, + 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x09, 0x42, 0x64, 0x1c, 0x11, 0x12, 0x42, 0x22, 0x5c, 0xac, + 0x89, 0x29, 0xb9, 0x99, 0x79, 0x12, 0x4c, 0x0a, 0x8c, 0x1a, 0x9c, 0x41, 0x10, 0x8e, 0x93, 0xdb, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, 0x44, 0xe9, 0xa4, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x17, 0x67, 0x67, 0x16, 0xe8, 0xe6, 0xa6, 0x96, 0xe9, 0x43, 0xdd, 0x5c, 0x81, 0xe4, 0xea, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x93, 0x8d, 0x01, - 0x01, 0x00, 0x00, 0xff, 0xff, 0x57, 0x0b, 0x3d, 0xe1, 0xd6, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x4a, 0xfb, 0xbf, 0x2c, 0xd6, 0x00, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -121,17 +121,21 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Version != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.Version)) + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintParams(dAtA, i, uint64(len(m.Admin))) i-- - dAtA[i] = 0x10 + dAtA[i] = 0x12 } - if len(m.MarketAuthority) > 0 { - i -= len(m.MarketAuthority) - copy(dAtA[i:], m.MarketAuthority) - i = encodeVarintParams(dAtA, i, uint64(len(m.MarketAuthority))) - i-- - dAtA[i] = 0xa + if len(m.MarketAuthorities) > 0 { + for iNdEx := len(m.MarketAuthorities) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.MarketAuthorities[iNdEx]) + copy(dAtA[i:], m.MarketAuthorities[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.MarketAuthorities[iNdEx]))) + i-- + dAtA[i] = 0xa + } } return len(dAtA) - i, nil } @@ -153,13 +157,16 @@ func (m *Params) Size() (n int) { } var l int _ = l - l = len(m.MarketAuthority) + if len(m.MarketAuthorities) > 0 { + for _, s := range m.MarketAuthorities { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + l = len(m.Admin) if l > 0 { n += 1 + l + sovParams(uint64(l)) } - if m.Version != 0 { - n += 1 + sovParams(uint64(m.Version)) - } return n } @@ -200,7 +207,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketAuthority", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MarketAuthorities", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -228,13 +235,13 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.MarketAuthority = string(dAtA[iNdEx:postIndex]) + m.MarketAuthorities = append(m.MarketAuthorities, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) } - m.Version = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -244,11 +251,24 @@ func (m *Params) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Version |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Admin = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/marketmap/types/params_test.go b/x/marketmap/types/params_test.go index dcc9dd18f..59558be36 100644 --- a/x/marketmap/types/params_test.go +++ b/x/marketmap/types/params_test.go @@ -3,6 +3,7 @@ package types_test import ( "testing" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" "github.com/skip-mev/slinky/x/marketmap/types" @@ -22,8 +23,43 @@ func TestValidateBasic(t *testing.T) { expectErr: false, }, { - name: "invalid authority", - params: types.NewParams("incorrect", 10), + name: "valid multiple authorities", + params: types.Params{ + MarketAuthorities: []string{authtypes.NewModuleAddress(authtypes.ModuleName).String(), types.DefaultMarketAuthority}, + Admin: types.DefaultAdmin, + }, + expectErr: false, + }, + { + name: "invalid admin", + params: types.Params{ + MarketAuthorities: []string{authtypes.NewModuleAddress(authtypes.ModuleName).String(), types.DefaultMarketAuthority}, + Admin: "invalid", + }, + expectErr: true, + }, + { + name: "invalid duplicate authority", + params: types.Params{ + MarketAuthorities: []string{types.DefaultMarketAuthority, types.DefaultMarketAuthority}, + Admin: types.DefaultAdmin, + }, + expectErr: true, + }, + { + name: "invalid authority string", + params: types.Params{ + MarketAuthorities: []string{"incorrect"}, + Admin: types.DefaultAdmin, + }, + expectErr: true, + }, + { + name: "invalid nil authority", + params: types.Params{ + MarketAuthorities: nil, + Admin: types.DefaultAdmin, + }, expectErr: true, }, { diff --git a/x/marketmap/types/path.go b/x/marketmap/types/path.go deleted file mode 100644 index 06269b4c1..000000000 --- a/x/marketmap/types/path.go +++ /dev/null @@ -1,238 +0,0 @@ -package types - -import ( - "fmt" - "strings" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" -) - -// NewPath returns a new Path instance. A Path is a list of convertable markets -// that will be used to convert the prices of a set of tickers to a common ticker. -func NewPath(ops ...Operation) (Path, error) { - p := Path{ - Operations: ops, - } - - if err := p.ValidateBasic(); err != nil { - return Path{}, err - } - - return p, nil -} - -// Match returns true if the path matches the provided ticker. -func (p *Path) Match(ticker string) bool { - if len(p.Operations) == 0 { - return false - } - - first := p.Operations[0] - base := first.CurrencyPair.Base - if first.Invert { - base = first.CurrencyPair.Quote - } - - last := p.Operations[len(p.Operations)-1] - quote := last.CurrencyPair.Quote - if last.Invert { - quote = last.CurrencyPair.Base - } - - return ticker == fmt.Sprintf("%s/%s", base, quote) -} - -// GetCurrencyPairs returns the set of CurrencyPairs in the path. Note that some of the CurrencyPairs -// may need to be inverted. This function does NOT return the inverted CurrencyPairs. -func (p *Path) GetCurrencyPairs() []slinkytypes.CurrencyPair { - cps := make([]slinkytypes.CurrencyPair, len(p.Operations)) - for i, op := range p.Operations { - cps[i] = op.CurrencyPair - } - return cps -} - -// ShowRoute returns the route of the path in human-readable format. -func (p *Path) ShowRoute() string { - hops := make([]string, len(p.Operations)) - for i, op := range p.Operations { - base := op.CurrencyPair.Base - if op.Invert { - base = op.CurrencyPair.Quote - } - - quote := op.CurrencyPair.Quote - if op.Invert { - quote = op.CurrencyPair.Base - } - - hops[i] = fmt.Sprintf("%s/%s", base, quote) - } - - return strings.Join(hops, " -> ") -} - -// ValidateBasic performs basic validation on the Path. Specifically this will check -// that order is topologically sorted for each market. For example, if the oracle -// receives a price for BTC/USDT and USDT/USD, the order must be BTC/USDT -> USDT/USD. -// Alternatively, if the oracle receives a price for BTC/USDT and USD/USDT, the order -// must be BTC/USDT -> USD/USDT (inverted == true). -func (p *Path) ValidateBasic() error { - if len(p.Operations) == 0 { - return fmt.Errorf("path cannot be empty") - } - - first := p.Operations[0] - if err := first.ValidateBasic(); err != nil { - return err - } - - if len(p.Operations) == 1 { - return nil - } - - if len(p.Operations) > MaxPathLength { - return fmt.Errorf("length of path cannot be longer than %d, got %d", MaxPathLength, len(p.Operations)) - } - - quote := first.CurrencyPair.Quote - if first.Invert { - quote = first.CurrencyPair.Base - } - - // Ensure that the path is a directed acyclic graph. - seen := map[slinkytypes.CurrencyPair]struct{}{ - first.CurrencyPair: {}, - } - for _, op := range p.Operations[1:] { - if err := op.ValidateBasic(); err != nil { - return err - } - - if op.Invert { - if _, ok := seen[op.CurrencyPair.Invert()]; ok { - return fmt.Errorf("duplicated pair found") - } - } - - if _, ok := seen[op.CurrencyPair]; ok { - return fmt.Errorf("path is not a directed acyclic graph") - } - seen[op.CurrencyPair] = struct{}{} - - switch { - case !op.Invert && quote != op.CurrencyPair.Base: - return fmt.Errorf("invalid path; expected %s, got %s", quote, op.CurrencyPair.Base) - case !op.Invert && quote == op.CurrencyPair.Base: - quote = op.CurrencyPair.Quote - case op.Invert && quote != op.CurrencyPair.Quote: - return fmt.Errorf("invalid path; expected %s, got %s", quote, op.CurrencyPair.Quote) - case op.Invert && quote == op.CurrencyPair.Quote: - quote = op.CurrencyPair.Base - } - } - - return nil -} - -// NewOperation returns a new Operation instance. An Operation is a single step -// in a path that represents a conversion from one ticker to another. The operation's -// ticker is a price feed that is supported by a set of providers and may be inverted -// if necessary. -func NewOperation(cp slinkytypes.CurrencyPair, invert bool) (Operation, error) { - o := Operation{ - CurrencyPair: cp, - Invert: invert, - } - - if err := o.ValidateBasic(); err != nil { - return Operation{}, err - } - - return o, nil -} - -// ValidateBasic performs basic validation on the Operation. -func (o *Operation) ValidateBasic() error { - return o.CurrencyPair.ValidateBasic() -} - -// ValidateBasic performs basic validation on the Paths. -func (p *Paths) ValidateBasic(cp slinkytypes.CurrencyPair) error { - if len(p.Paths) == 0 { - return fmt.Errorf("at least one path is required for a ticker to be calculated") - } - - // Track the routes to ensure that there are no duplicates. - routes := make(map[string]struct{}) - for _, path := range p.Paths { - if err := path.ValidateBasic(); err != nil { - return err - } - - route := path.ShowRoute() - if _, ok := routes[route]; ok { - return fmt.Errorf("duplicate route found: %s", route) - } - routes[route] = struct{}{} - - // Ensure that the path ends up converting to the ticker. - if !path.Match(cp.String()) { - return fmt.Errorf("path does not match ticker") - } - } - - return nil -} - -// UniqueTickers returns all unique tickers across all paths that -// are part of the Paths. This is particularly useful for determining the -// set of markets that are required for a given ticker as well as ensuring -// that a given set of providers can provide the required markets. -func (p *Paths) UniqueTickers() map[slinkytypes.CurrencyPair]struct{} { - seen := make(map[slinkytypes.CurrencyPair]struct{}) - - for _, path := range p.Paths { - for _, cp := range path.GetCurrencyPairs() { - seen[cp] = struct{}{} - } - } - - return seen -} - -// Equal returns true iff the Paths is equal to the given Paths. -func (p *Paths) Equal(other Paths) bool { - if len(p.Paths) != len(other.Paths) { - return false - } - - for i, path := range p.Paths { - if !path.Equal(other.Paths[i]) { - return false - } - } - - return true -} - -// Equal returns true iff the Path is equal to the given Path. -func (p *Path) Equal(other Path) bool { - if len(p.Operations) != len(other.Operations) { - return false - } - - for i, op := range p.Operations { - if !op.Equal(other.Operations[i]) { - return false - } - } - - return true -} - -// Equal returns true iff the Operation is equal to the given Operation. -func (o *Operation) Equal(other Operation) bool { - return o.CurrencyPair.Equal(other.CurrencyPair) && - o.Invert == other.Invert && o.Provider == other.Provider -} diff --git a/x/marketmap/types/path_test.go b/x/marketmap/types/path_test.go deleted file mode 100644 index 204082832..000000000 --- a/x/marketmap/types/path_test.go +++ /dev/null @@ -1,600 +0,0 @@ -package types_test - -import ( - "testing" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/marketmap/types" -) - -var ( - btcusdt = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - } - - btcusdtPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - }, - }, - }, - }, - } - - btcusdtProviders = types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-usdt", - }, - }, - } - - usdtusd = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - } - - usdtusdPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "USD", - }, - }, - }, - }, - }, - } - - usdtusdProviders = types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "usdt-usd", - }, - }, - } - - usdcusd = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDC", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - } - - usdcusdPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDC", - Quote: "USD", - }, - }, - }, - }, - }, - } - - usdcusdProviders = types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "usdc-usd", - }, - }, - } - - ethusdt = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - } - - ethusdtPaths = types.Paths{ - Paths: []types.Path{ - { - Operations: []types.Operation{ - { - Provider: "kucoin", - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - }, - }, - }, - }, - } - - ethusdtProviders = types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "eth-usdt", - }, - }, - } - - usdteth = types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "ETHEREUM", - }, - Decimals: 8, - MinProviderCount: 1, - } - - tickers = map[string]types.Ticker{ - btcusdt.String(): btcusdt, - usdcusd.String(): usdcusd, - usdtusd.String(): usdtusd, - ethusdt.String(): ethusdt, - } - - paths = map[string]types.Paths{ - btcusdt.String(): btcusdtPaths, - usdcusd.String(): usdcusdPaths, - usdtusd.String(): usdtusdPaths, - ethusdt.String(): ethusdtPaths, - } - - providers = map[string]types.Providers{ - btcusdt.String(): btcusdtProviders, - usdcusd.String(): usdcusdProviders, - usdtusd.String(): usdtusdProviders, - ethusdt.String(): ethusdtProviders, - } - - markets = struct { - tickers map[string]types.Ticker - paths map[string]types.Paths - providers map[string]types.Providers - }{ - tickers: tickers, - paths: paths, - providers: providers, - } - - _ = markets -) - -func TestPaths(t *testing.T) { - testCases := []struct { - name string - paths types.Paths - currencyPair slinkytypes.CurrencyPair - expErr bool - }{ - { - name: "valid", - paths: btcusdtPaths, - currencyPair: btcusdt.CurrencyPair, - expErr: false, - }, - { - name: "invalid", - paths: types.Paths{}, - currencyPair: btcusdt.CurrencyPair, - expErr: true, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.paths.ValidateBasic(tc.currencyPair) - if tc.expErr { - require.Error(t, err) - return - } - - require.NoError(t, err) - }) - } -} - -func TestPathsEqual(t *testing.T) { - cases := []struct { - name string - paths types.Paths - other types.Paths - exp bool - }{ - { - name: "equal paths", - paths: btcusdtPaths, - other: btcusdtPaths, - exp: true, - }, - { - name: "different length", - paths: btcusdtPaths, - other: types.Paths{}, - exp: false, - }, - { - name: "different paths", - paths: btcusdtPaths, - other: ethusdtPaths, - exp: false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.paths.Equal(tc.other), tc.exp) - }) - } -} - -func TestPath(t *testing.T) { - testCases := []struct { - name string - path types.Path - target string - expErr bool - }{ - { - name: "empty path", - path: types.Path{}, - target: "", - expErr: true, - }, - { - name: "invalid path with a single operation", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: slinkytypes.CurrencyPair{}, - }, - }, - }, - target: "", - expErr: true, - }, - { - name: "invalid path with multiple operations with a bad ticker in the route", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: slinkytypes.CurrencyPair{}, - }, - }, - }, - target: "", - expErr: true, - }, - { - name: "invalid path with multiple operations and mismatching tickers", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: ethusdt.CurrencyPair, - }, - }, - }, - target: "", - expErr: true, - }, - { - name: "invalid path with multiple operations and cyclic graph", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: usdtusd.CurrencyPair, - }, - { - CurrencyPair: usdtusd.CurrencyPair, - Invert: true, - }, - }, - }, - target: "", - expErr: true, - }, - { - name: "invalid path with multiple operations inverted duplicate", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: ethusdt.CurrencyPair, - }, - { - CurrencyPair: usdteth.CurrencyPair, - Invert: true, - }, - }, - }, - target: "", - expErr: true, - }, - { - name: "valid path with a single operation", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - }, - }, - target: "BITCOIN/USDT", - expErr: false, - }, - { - name: "valid path with multiple operations", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: usdtusd.CurrencyPair, - }, - }, - }, - target: "BITCOIN/USD", - expErr: false, - }, - { - name: "valid path with multiple operations and inverted tickers", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: usdtusd.CurrencyPair, - Invert: true, - }, - { - CurrencyPair: btcusdt.CurrencyPair, - Invert: true, - }, - }, - }, - target: "USD/BITCOIN", - expErr: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.path.ValidateBasic() - if tc.expErr { - require.Error(t, err) - } else { - require.NoError(t, err) - require.True(t, tc.path.Match(tc.target)) - } - }) - } -} - -func TestPathEqual(t *testing.T) { - cases := []struct { - name string - path types.Path - other types.Path - exp bool - }{ - { - name: "equal paths", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: usdtusd.CurrencyPair, - }, - }, - }, - other: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: usdtusd.CurrencyPair, - }, - }, - }, - exp: true, - }, - { - name: "different length", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - }, - }, - other: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - { - CurrencyPair: usdtusd.CurrencyPair, - }, - }, - }, - exp: false, - }, - { - name: "different operations", - path: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: btcusdt.CurrencyPair, - }, - }, - }, - other: types.Path{ - Operations: []types.Operation{ - { - CurrencyPair: usdtusd.CurrencyPair, - }, - }, - }, - exp: false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.path.Equal(tc.other), tc.exp) - }) - } -} - -func TestOperation(t *testing.T) { - t.Run("valid operation", func(t *testing.T) { - cp := slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - } - - _, err := types.NewOperation(cp, false) - require.NoError(t, err) - }) - - t.Run("invalid operation", func(t *testing.T) { - cp := slinkytypes.CurrencyPair{} - _, err := types.NewOperation(cp, false) - require.Error(t, err) - }) -} - -func TestOperationEqual(t *testing.T) { - cases := []struct { - name string - op types.Operation - other types.Operation - exp bool - }{ - { - name: "equal operations", - op: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: false, - }, - other: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: false, - }, - exp: true, - }, - { - name: "different base", - op: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: false, - }, - other: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: false, - }, - exp: false, - }, - { - name: "different invert strategy", - op: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: false, - }, - other: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: true, - }, - exp: false, - }, - { - name: "different provider", - op: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "kucoin", - Invert: false, - }, - other: types.Operation{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Provider: "binance", - Invert: false, - }, - exp: false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.op.Equal(tc.other), tc.exp) - }) - } -} diff --git a/x/marketmap/types/provider.go b/x/marketmap/types/provider.go index bc51ccc0e..ab1fb7e3c 100644 --- a/x/marketmap/types/provider.go +++ b/x/marketmap/types/provider.go @@ -2,62 +2,65 @@ package types import ( "fmt" -) -const ( - MaxProviderNameFieldLength = 128 - MaxProviderTickerFieldLength = 256 + "github.com/skip-mev/slinky/pkg/json" ) -// ValidateBasic performs basic validation on Providers. -func (p *Providers) ValidateBasic() error { - for _, provider := range p.Providers { - if err := provider.ValidateBasic(); err != nil { - return err - } - } - - return nil -} - // ValidateBasic performs basic validation on a ProviderConfig. func (pc *ProviderConfig) ValidateBasic() error { if len(pc.Name) == 0 { return fmt.Errorf("provider name must not be empty") } - if len(pc.Name) > MaxProviderNameFieldLength { - return fmt.Errorf("provider length is longer than maximum length of %d", MaxProviderNameFieldLength) - } - if len(pc.OffChainTicker) == 0 { return fmt.Errorf("provider offchain ticker must not be empty") } - if len(pc.OffChainTicker) > MaxProviderTickerFieldLength { - return fmt.Errorf("provider offchain ticker is longer than maximum length of %d", MaxProviderTickerFieldLength) + // NormalizeByPair is allowed to be empty + if pc.NormalizeByPair != nil { + if err := pc.NormalizeByPair.ValidateBasic(); err != nil { + return err + } + } + + if len(pc.Metadata_JSON) > MaxMetadataJSONFieldLength { + return fmt.Errorf("metadata json field is longer than maximum length of %d", MaxMetadataJSONFieldLength) + } + + if err := json.IsValid([]byte(pc.Metadata_JSON)); err != nil { + return fmt.Errorf("invalid provider config metadata json: %w", err) } return nil } -// Equal returns true iff the Providers is equal to the given Providers. -func (p *Providers) Equal(other Providers) bool { - if len(p.Providers) != len(other.Providers) { +// Equal returns true iff the ProviderConfig is equal to the given ProviderConfig. +func (pc *ProviderConfig) Equal(other ProviderConfig) bool { + if pc.Name != other.Name { + return false + } + + if pc.OffChainTicker != other.OffChainTicker { return false } - for i, provider := range p.Providers { - if !provider.Equal(other.Providers[i]) { + if pc.Invert != other.Invert { + return false + } + + if pc.NormalizeByPair == nil { + if other.NormalizeByPair != nil { + return false + } + } else { + if other.NormalizeByPair == nil { return false } - } - return true -} + if !pc.NormalizeByPair.Equal(*other.NormalizeByPair) { + return false + } + } -// Equal returns true iff the ProviderConfig is equal to the given ProviderConfig. -func (pc *ProviderConfig) Equal(other ProviderConfig) bool { - return pc.Name == other.Name && - pc.OffChainTicker == other.OffChainTicker + return pc.Metadata_JSON == other.Metadata_JSON } diff --git a/x/marketmap/types/provider_test.go b/x/marketmap/types/provider_test.go index a66dcccaf..0a4ec238d 100644 --- a/x/marketmap/types/provider_test.go +++ b/x/marketmap/types/provider_test.go @@ -5,6 +5,7 @@ import ( "github.com/stretchr/testify/require" + slinkytypes "github.com/skip-mev/slinky/pkg/types" "github.com/skip-mev/slinky/testutil" "github.com/skip-mev/slinky/x/marketmap/types" ) @@ -14,126 +15,133 @@ func TestProviderConfigValidateBasic(t *testing.T) { pc := types.ProviderConfig{ Name: "mexc", OffChainTicker: "ticker", + Metadata_JSON: "", } require.NoError(t, pc.ValidateBasic()) }) - t.Run("invalid empty name - fail", func(t *testing.T) { + t.Run("valid config inverted - pass", func(t *testing.T) { + pc := types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Invert: true, + Metadata_JSON: "", + } + require.NoError(t, pc.ValidateBasic()) + }) + t.Run("valid config with normalize by - pass", func(t *testing.T) { + pc := types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "BASE", + Quote: "QUOTE", + }, + Metadata_JSON: "", + } + require.NoError(t, pc.ValidateBasic()) + }) + t.Run("invalid config with normalize by - fail", func(t *testing.T) { + pc := types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "BASE", + Quote: "", + }, + Metadata_JSON: "", + } + require.Error(t, pc.ValidateBasic()) + }) + t.Run("invalid name - fail", func(t *testing.T) { pc := types.ProviderConfig{ Name: "", OffChainTicker: "ticker", + Metadata_JSON: "", } require.Error(t, pc.ValidateBasic()) }) - t.Run("invalid empty offchain ticker - fail", func(t *testing.T) { + t.Run("invalid offchain ticker - fail", func(t *testing.T) { pc := types.ProviderConfig{ Name: "mexc", OffChainTicker: "", + Metadata_JSON: "", } require.Error(t, pc.ValidateBasic()) }) - t.Run("invalid too long name - fail", func(t *testing.T) { + t.Run("invalid json - fail", func(t *testing.T) { pc := types.ProviderConfig{ - Name: testutil.RandomString(types.MaxProviderNameFieldLength + 1), + Name: "mexc", OffChainTicker: "ticker", + Metadata_JSON: "invalid", } require.Error(t, pc.ValidateBasic()) }) - t.Run("invalid too long offchain ticker - fail", func(t *testing.T) { + t.Run("invalid json length - fail", func(t *testing.T) { pc := types.ProviderConfig{ Name: "mexc", - OffChainTicker: testutil.RandomString(types.MaxProviderTickerFieldLength + 1), + OffChainTicker: "ticker", + Metadata_JSON: testutil.RandomString(types.MaxMetadataJSONFieldLength + 1), } require.Error(t, pc.ValidateBasic()) }) } -func TestProvidersEqual(t *testing.T) { +func TestProviderConfigEqual(t *testing.T) { cases := []struct { name string - p types.Providers - other types.Providers + pc types.ProviderConfig + other types.ProviderConfig exp bool }{ { - name: "equal", - p: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "mexc", - OffChainTicker: "ticker", - }, - }, + name: "equal - basic", + pc: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Metadata_JSON: "", }, - other: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "mexc", - OffChainTicker: "ticker", - }, - }, + other: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Metadata_JSON: "", }, exp: true, }, { - name: "different length", - p: types.Providers{ - Providers: []types.ProviderConfig{}, - }, - other: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "mexc", - OffChainTicker: "ticker", - }, - }, - }, - exp: false, - }, - { - name: "different provider", - p: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "mexc", - OffChainTicker: "ticker", - }, + name: "equal - inverted with normalize by", + pc: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "BASE", + Quote: "QUOTE", }, + Invert: true, + Metadata_JSON: "", }, - other: types.Providers{ - Providers: []types.ProviderConfig{ - { - Name: "binance", - OffChainTicker: "ticker", - }, + other: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "BASE", + Quote: "QUOTE", }, + Invert: true, + Metadata_JSON: "", }, - exp: false, + exp: true, }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.exp, tc.p.Equal(tc.other)) - }) - } -} - -func TestProviderConfigEqual(t *testing.T) { - cases := []struct { - name string - pc types.ProviderConfig - other types.ProviderConfig - exp bool - }{ { - name: "equal", + name: "equal - same metadata", pc: types.ProviderConfig{ Name: "mexc", OffChainTicker: "ticker", + Metadata_JSON: "{data: 1}", }, other: types.ProviderConfig{ Name: "mexc", OffChainTicker: "ticker", + Metadata_JSON: "{data: 1}", }, exp: true, }, @@ -161,6 +169,60 @@ func TestProviderConfigEqual(t *testing.T) { }, exp: false, }, + { + name: "different invert", + pc: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Invert: true, + Metadata_JSON: "", + }, + other: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Invert: false, + Metadata_JSON: "", + }, + exp: false, + }, + { + name: "different normalize by", + pc: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Invert: true, + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "BASE", + Quote: "QUOTE", + }, + Metadata_JSON: "", + }, + other: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Invert: true, + NormalizeByPair: &slinkytypes.CurrencyPair{ + Base: "QUOTE", + Quote: "QUOTE", + }, + Metadata_JSON: "", + }, + exp: false, + }, + { + name: "different metadata", + pc: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Metadata_JSON: "{data: 1}", + }, + other: types.ProviderConfig{ + Name: "mexc", + OffChainTicker: "ticker", + Metadata_JSON: "", + }, + exp: false, + }, } for _, tc := range cases { diff --git a/x/marketmap/types/query.pb.go b/x/marketmap/types/query.pb.go index c19f78c5f..f64f932eb 100644 --- a/x/marketmap/types/query.pb.go +++ b/x/marketmap/types/query.pb.go @@ -9,6 +9,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" + types "github.com/skip-mev/slinky/pkg/types" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -29,23 +30,23 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// GetMarketMapRequest is the query request for the GetMarketMap query. +// MarketMapRequest is the query request for the MarketMap query. // It takes no arguments. -type GetMarketMapRequest struct { +type MarketMapRequest struct { } -func (m *GetMarketMapRequest) Reset() { *m = GetMarketMapRequest{} } -func (m *GetMarketMapRequest) String() string { return proto.CompactTextString(m) } -func (*GetMarketMapRequest) ProtoMessage() {} -func (*GetMarketMapRequest) Descriptor() ([]byte, []int) { +func (m *MarketMapRequest) Reset() { *m = MarketMapRequest{} } +func (m *MarketMapRequest) String() string { return proto.CompactTextString(m) } +func (*MarketMapRequest) ProtoMessage() {} +func (*MarketMapRequest) Descriptor() ([]byte, []int) { return fileDescriptor_b5d6ff68f3c474a0, []int{0} } -func (m *GetMarketMapRequest) XXX_Unmarshal(b []byte) error { +func (m *MarketMapRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetMarketMapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MarketMapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetMarketMapRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_MarketMapRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -55,20 +56,20 @@ func (m *GetMarketMapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *GetMarketMapRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetMarketMapRequest.Merge(m, src) +func (m *MarketMapRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MarketMapRequest.Merge(m, src) } -func (m *GetMarketMapRequest) XXX_Size() int { +func (m *MarketMapRequest) XXX_Size() int { return m.Size() } -func (m *GetMarketMapRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetMarketMapRequest.DiscardUnknown(m) +func (m *MarketMapRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MarketMapRequest.DiscardUnknown(m) } -var xxx_messageInfo_GetMarketMapRequest proto.InternalMessageInfo +var xxx_messageInfo_MarketMapRequest proto.InternalMessageInfo -// GetMarketMapResponse is the query response for the GetMarketMap query. -type GetMarketMapResponse struct { +// MarketMapResponse is the query response for the MarketMap query. +type MarketMapResponse struct { // MarketMap defines the global set of market configurations for all providers // and markets. MarketMap MarketMap `protobuf:"bytes,1,opt,name=market_map,json=marketMap,proto3" json:"market_map"` @@ -76,25 +77,22 @@ type GetMarketMapResponse struct { // This field can be used as an optimization for clients checking if there // is a new update to the map. LastUpdated uint64 `protobuf:"varint,2,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - // Version is the schema version for the MarketMap data structure and query - // response. - Version uint64 `protobuf:"varint,3,opt,name=version,proto3" json:"version,omitempty"` // ChainId is the chain identifier for the market map. - ChainId string `protobuf:"bytes,4,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` } -func (m *GetMarketMapResponse) Reset() { *m = GetMarketMapResponse{} } -func (m *GetMarketMapResponse) String() string { return proto.CompactTextString(m) } -func (*GetMarketMapResponse) ProtoMessage() {} -func (*GetMarketMapResponse) Descriptor() ([]byte, []int) { +func (m *MarketMapResponse) Reset() { *m = MarketMapResponse{} } +func (m *MarketMapResponse) String() string { return proto.CompactTextString(m) } +func (*MarketMapResponse) ProtoMessage() {} +func (*MarketMapResponse) Descriptor() ([]byte, []int) { return fileDescriptor_b5d6ff68f3c474a0, []int{1} } -func (m *GetMarketMapResponse) XXX_Unmarshal(b []byte) error { +func (m *MarketMapResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetMarketMapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MarketMapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetMarketMapResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MarketMapResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -104,44 +102,131 @@ func (m *GetMarketMapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte return b[:n], nil } } -func (m *GetMarketMapResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetMarketMapResponse.Merge(m, src) +func (m *MarketMapResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MarketMapResponse.Merge(m, src) } -func (m *GetMarketMapResponse) XXX_Size() int { +func (m *MarketMapResponse) XXX_Size() int { return m.Size() } -func (m *GetMarketMapResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetMarketMapResponse.DiscardUnknown(m) +func (m *MarketMapResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MarketMapResponse.DiscardUnknown(m) } -var xxx_messageInfo_GetMarketMapResponse proto.InternalMessageInfo +var xxx_messageInfo_MarketMapResponse proto.InternalMessageInfo -func (m *GetMarketMapResponse) GetMarketMap() MarketMap { +func (m *MarketMapResponse) GetMarketMap() MarketMap { if m != nil { return m.MarketMap } return MarketMap{} } -func (m *GetMarketMapResponse) GetLastUpdated() uint64 { +func (m *MarketMapResponse) GetLastUpdated() uint64 { if m != nil { return m.LastUpdated } return 0 } -func (m *GetMarketMapResponse) GetVersion() uint64 { +func (m *MarketMapResponse) GetChainId() string { if m != nil { - return m.Version + return m.ChainId + } + return "" +} + +// MarketRequest is the query request for the Market query. +// It takes the currency pair of the market as an argument. +type MarketRequest struct { + // CurrencyPair is the currency pair associated with the market being + // requested. + CurrencyPair types.CurrencyPair `protobuf:"bytes,3,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair"` +} + +func (m *MarketRequest) Reset() { *m = MarketRequest{} } +func (m *MarketRequest) String() string { return proto.CompactTextString(m) } +func (*MarketRequest) ProtoMessage() {} +func (*MarketRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b5d6ff68f3c474a0, []int{2} +} +func (m *MarketRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MarketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MarketRequest.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return 0 } +func (m *MarketRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_MarketRequest.Merge(m, src) +} +func (m *MarketRequest) XXX_Size() int { + return m.Size() +} +func (m *MarketRequest) XXX_DiscardUnknown() { + xxx_messageInfo_MarketRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_MarketRequest proto.InternalMessageInfo -func (m *GetMarketMapResponse) GetChainId() string { +func (m *MarketRequest) GetCurrencyPair() types.CurrencyPair { if m != nil { - return m.ChainId + return m.CurrencyPair } - return "" + return types.CurrencyPair{} +} + +// MarketResponse is the query response for the Market query. +type MarketResponse struct { + // Market is the configuration of a single market to be price-fetched for. + Market Market `protobuf:"bytes,1,opt,name=market,proto3" json:"market"` +} + +func (m *MarketResponse) Reset() { *m = MarketResponse{} } +func (m *MarketResponse) String() string { return proto.CompactTextString(m) } +func (*MarketResponse) ProtoMessage() {} +func (*MarketResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b5d6ff68f3c474a0, []int{3} +} +func (m *MarketResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MarketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MarketResponse.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 *MarketResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MarketResponse.Merge(m, src) +} +func (m *MarketResponse) XXX_Size() int { + return m.Size() +} +func (m *MarketResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MarketResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MarketResponse proto.InternalMessageInfo + +func (m *MarketResponse) GetMarket() Market { + if m != nil { + return m.Market + } + return Market{} } // ParamsRequest is the request type for the Query/Params RPC method. @@ -152,7 +237,7 @@ func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } func (*ParamsRequest) ProtoMessage() {} func (*ParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b5d6ff68f3c474a0, []int{2} + return fileDescriptor_b5d6ff68f3c474a0, []int{4} } func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -190,7 +275,7 @@ func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } func (*ParamsResponse) ProtoMessage() {} func (*ParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b5d6ff68f3c474a0, []int{3} + return fileDescriptor_b5d6ff68f3c474a0, []int{5} } func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -226,23 +311,23 @@ func (m *ParamsResponse) GetParams() Params { return Params{} } -// GetLastUpdatedRequest is the request type for the Query/LastUpdated RPC +// LastUpdatedRequest is the request type for the Query/LastUpdated RPC // method. -type GetLastUpdatedRequest struct { +type LastUpdatedRequest struct { } -func (m *GetLastUpdatedRequest) Reset() { *m = GetLastUpdatedRequest{} } -func (m *GetLastUpdatedRequest) String() string { return proto.CompactTextString(m) } -func (*GetLastUpdatedRequest) ProtoMessage() {} -func (*GetLastUpdatedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b5d6ff68f3c474a0, []int{4} +func (m *LastUpdatedRequest) Reset() { *m = LastUpdatedRequest{} } +func (m *LastUpdatedRequest) String() string { return proto.CompactTextString(m) } +func (*LastUpdatedRequest) ProtoMessage() {} +func (*LastUpdatedRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_b5d6ff68f3c474a0, []int{6} } -func (m *GetLastUpdatedRequest) XXX_Unmarshal(b []byte) error { +func (m *LastUpdatedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetLastUpdatedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *LastUpdatedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetLastUpdatedRequest.Marshal(b, m, deterministic) + return xxx_messageInfo_LastUpdatedRequest.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -252,36 +337,36 @@ func (m *GetLastUpdatedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byt return b[:n], nil } } -func (m *GetLastUpdatedRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetLastUpdatedRequest.Merge(m, src) +func (m *LastUpdatedRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_LastUpdatedRequest.Merge(m, src) } -func (m *GetLastUpdatedRequest) XXX_Size() int { +func (m *LastUpdatedRequest) XXX_Size() int { return m.Size() } -func (m *GetLastUpdatedRequest) XXX_DiscardUnknown() { - xxx_messageInfo_GetLastUpdatedRequest.DiscardUnknown(m) +func (m *LastUpdatedRequest) XXX_DiscardUnknown() { + xxx_messageInfo_LastUpdatedRequest.DiscardUnknown(m) } -var xxx_messageInfo_GetLastUpdatedRequest proto.InternalMessageInfo +var xxx_messageInfo_LastUpdatedRequest proto.InternalMessageInfo -// GetLastUpdatedResponse is the response type for the Query/LastUpdated RPC +// LastUpdatedResponse is the response type for the Query/LastUpdated RPC // method. -type GetLastUpdatedResponse struct { +type LastUpdatedResponse struct { LastUpdated uint64 `protobuf:"varint,1,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` } -func (m *GetLastUpdatedResponse) Reset() { *m = GetLastUpdatedResponse{} } -func (m *GetLastUpdatedResponse) String() string { return proto.CompactTextString(m) } -func (*GetLastUpdatedResponse) ProtoMessage() {} -func (*GetLastUpdatedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b5d6ff68f3c474a0, []int{5} +func (m *LastUpdatedResponse) Reset() { *m = LastUpdatedResponse{} } +func (m *LastUpdatedResponse) String() string { return proto.CompactTextString(m) } +func (*LastUpdatedResponse) ProtoMessage() {} +func (*LastUpdatedResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_b5d6ff68f3c474a0, []int{7} } -func (m *GetLastUpdatedResponse) XXX_Unmarshal(b []byte) error { +func (m *LastUpdatedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *GetLastUpdatedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *LastUpdatedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_GetLastUpdatedResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_LastUpdatedResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -291,19 +376,19 @@ func (m *GetLastUpdatedResponse) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *GetLastUpdatedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_GetLastUpdatedResponse.Merge(m, src) +func (m *LastUpdatedResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_LastUpdatedResponse.Merge(m, src) } -func (m *GetLastUpdatedResponse) XXX_Size() int { +func (m *LastUpdatedResponse) XXX_Size() int { return m.Size() } -func (m *GetLastUpdatedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_GetLastUpdatedResponse.DiscardUnknown(m) +func (m *LastUpdatedResponse) XXX_DiscardUnknown() { + xxx_messageInfo_LastUpdatedResponse.DiscardUnknown(m) } -var xxx_messageInfo_GetLastUpdatedResponse proto.InternalMessageInfo +var xxx_messageInfo_LastUpdatedResponse proto.InternalMessageInfo -func (m *GetLastUpdatedResponse) GetLastUpdated() uint64 { +func (m *LastUpdatedResponse) GetLastUpdated() uint64 { if m != nil { return m.LastUpdated } @@ -311,49 +396,55 @@ func (m *GetLastUpdatedResponse) GetLastUpdated() uint64 { } func init() { - proto.RegisterType((*GetMarketMapRequest)(nil), "slinky.marketmap.v1.GetMarketMapRequest") - proto.RegisterType((*GetMarketMapResponse)(nil), "slinky.marketmap.v1.GetMarketMapResponse") + proto.RegisterType((*MarketMapRequest)(nil), "slinky.marketmap.v1.MarketMapRequest") + proto.RegisterType((*MarketMapResponse)(nil), "slinky.marketmap.v1.MarketMapResponse") + proto.RegisterType((*MarketRequest)(nil), "slinky.marketmap.v1.MarketRequest") + proto.RegisterType((*MarketResponse)(nil), "slinky.marketmap.v1.MarketResponse") proto.RegisterType((*ParamsRequest)(nil), "slinky.marketmap.v1.ParamsRequest") proto.RegisterType((*ParamsResponse)(nil), "slinky.marketmap.v1.ParamsResponse") - proto.RegisterType((*GetLastUpdatedRequest)(nil), "slinky.marketmap.v1.GetLastUpdatedRequest") - proto.RegisterType((*GetLastUpdatedResponse)(nil), "slinky.marketmap.v1.GetLastUpdatedResponse") + proto.RegisterType((*LastUpdatedRequest)(nil), "slinky.marketmap.v1.LastUpdatedRequest") + proto.RegisterType((*LastUpdatedResponse)(nil), "slinky.marketmap.v1.LastUpdatedResponse") } func init() { proto.RegisterFile("slinky/marketmap/v1/query.proto", fileDescriptor_b5d6ff68f3c474a0) } var fileDescriptor_b5d6ff68f3c474a0 = []byte{ - // 483 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0x4d, 0x6f, 0xd3, 0x40, - 0x10, 0xcd, 0xb6, 0x21, 0x25, 0x13, 0x3e, 0xa4, 0x6d, 0x0b, 0x26, 0x05, 0xd7, 0x75, 0x24, 0x94, - 0xf2, 0xe1, 0x55, 0xcb, 0x09, 0x71, 0x2b, 0x12, 0x15, 0x82, 0x4a, 0x10, 0x89, 0x0b, 0x97, 0x68, - 0xdb, 0xac, 0x5c, 0x2b, 0xb1, 0x77, 0xeb, 0x5d, 0x5b, 0xe4, 0xca, 0x89, 0x23, 0x88, 0x3b, 0x7f, - 0x82, 0x3f, 0xd1, 0x63, 0x25, 0x2e, 0x9c, 0x10, 0x4a, 0xf8, 0x21, 0x28, 0xbb, 0xeb, 0x10, 0x5a, - 0x27, 0xea, 0xcd, 0x33, 0xf3, 0x66, 0xde, 0x7b, 0x33, 0x5e, 0xd8, 0x94, 0x83, 0x28, 0xe9, 0x0f, - 0x49, 0x4c, 0xd3, 0x3e, 0x53, 0x31, 0x15, 0x24, 0xdf, 0x21, 0x27, 0x19, 0x4b, 0x87, 0x81, 0x48, - 0xb9, 0xe2, 0x78, 0xd5, 0x00, 0x82, 0x29, 0x20, 0xc8, 0x77, 0x9a, 0x6b, 0x21, 0x0f, 0xb9, 0xae, - 0x93, 0xc9, 0x97, 0x81, 0x36, 0xef, 0x86, 0x9c, 0x87, 0x03, 0x46, 0xa8, 0x88, 0x08, 0x4d, 0x12, - 0xae, 0xa8, 0x8a, 0x78, 0x22, 0x6d, 0xd5, 0x2b, 0x63, 0x32, 0xc1, 0x22, 0x84, 0xa0, 0x29, 0x8d, - 0xed, 0x0c, 0x7f, 0x1d, 0x56, 0xf7, 0x99, 0x3a, 0xd0, 0xf5, 0x03, 0x2a, 0x3a, 0xec, 0x24, 0x63, - 0x52, 0xf9, 0xdf, 0x11, 0xac, 0xfd, 0x9f, 0x97, 0x82, 0x27, 0x92, 0xe1, 0xe7, 0x00, 0x66, 0x58, - 0x37, 0xa6, 0xc2, 0x41, 0x1e, 0x6a, 0x37, 0x76, 0xdd, 0xa0, 0xc4, 0x51, 0x30, 0xed, 0xdd, 0xab, - 0x9e, 0xfe, 0xda, 0xac, 0x74, 0xea, 0x71, 0x91, 0xc0, 0x5b, 0x70, 0x6d, 0x40, 0xa5, 0xea, 0x66, - 0xa2, 0x47, 0x15, 0xeb, 0x39, 0x4b, 0x1e, 0x6a, 0x57, 0x3b, 0x8d, 0x49, 0xee, 0x9d, 0x49, 0x61, - 0x07, 0x56, 0x72, 0x96, 0xca, 0x88, 0x27, 0xce, 0xb2, 0xae, 0x16, 0x21, 0xbe, 0x03, 0x57, 0x8f, - 0x8e, 0x69, 0x94, 0x74, 0xa3, 0x9e, 0x53, 0xf5, 0x50, 0xbb, 0xde, 0x59, 0xd1, 0xf1, 0xcb, 0x9e, - 0x7f, 0x13, 0xae, 0xbf, 0xd1, 0xe6, 0x0a, 0x1b, 0xaf, 0xe0, 0x46, 0x91, 0xb0, 0xfa, 0x9f, 0x42, - 0xcd, 0xf8, 0xb7, 0xda, 0x37, 0x4a, 0xb5, 0x9b, 0x26, 0x2b, 0xdc, 0x36, 0xf8, 0xb7, 0x61, 0x7d, - 0x9f, 0xa9, 0xd7, 0xff, 0x44, 0x16, 0x2c, 0xcf, 0xe0, 0xd6, 0xf9, 0x82, 0x65, 0x3b, 0x6f, 0x14, - 0x5d, 0x30, 0xba, 0xfb, 0x6d, 0x19, 0xae, 0xbc, 0x9d, 0xfc, 0x1d, 0xf8, 0x13, 0x82, 0xfa, 0x74, - 0x69, 0xb8, 0x5d, 0x2a, 0xac, 0xe4, 0x56, 0xcd, 0xed, 0x4b, 0x20, 0x8d, 0x1e, 0xff, 0xfe, 0xc7, - 0x1f, 0x7f, 0xbe, 0x2e, 0x79, 0xd8, 0x25, 0xf3, 0x7f, 0x9d, 0x98, 0x0a, 0xfc, 0x05, 0x41, 0x63, - 0xc6, 0x0f, 0x7e, 0x30, 0x8f, 0xe2, 0xe2, 0x36, 0x9a, 0x0f, 0x2f, 0x85, 0xb5, 0x82, 0xb6, 0xb5, - 0xa0, 0x16, 0xde, 0x2a, 0x15, 0x34, 0xbb, 0x3b, 0x9c, 0x43, 0xcd, 0x9c, 0x05, 0xfb, 0x0b, 0x6e, - 0x56, 0xa8, 0x68, 0x2d, 0xc4, 0x58, 0xf6, 0x96, 0x66, 0xbf, 0x87, 0x37, 0xc8, 0xfc, 0x77, 0xb2, - 0xf7, 0xe2, 0x74, 0xe4, 0xa2, 0xb3, 0x91, 0x8b, 0x7e, 0x8f, 0x5c, 0xf4, 0x79, 0xec, 0x56, 0xce, - 0xc6, 0x6e, 0xe5, 0xe7, 0xd8, 0xad, 0xbc, 0x7f, 0x14, 0x46, 0xea, 0x38, 0x3b, 0x0c, 0x8e, 0x78, - 0x4c, 0x64, 0x3f, 0x12, 0x8f, 0x63, 0x96, 0x17, 0x93, 0x3e, 0xcc, 0xcc, 0x52, 0x43, 0xc1, 0xe4, - 0x61, 0x4d, 0x3f, 0xb8, 0x27, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0x96, 0x38, 0x94, 0x38, 0x20, - 0x04, 0x00, 0x00, + // 545 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x84, 0x54, 0x4d, 0x6f, 0xd3, 0x40, + 0x10, 0xcd, 0x96, 0x12, 0xc8, 0xa4, 0x29, 0xb0, 0xed, 0x21, 0xa4, 0xd4, 0x75, 0x1d, 0x51, 0x82, + 0x04, 0xb6, 0x1a, 0x2e, 0x70, 0x6d, 0x25, 0x04, 0x2a, 0x95, 0x4a, 0x24, 0x0e, 0x70, 0x89, 0xb6, + 0xce, 0xca, 0xb5, 0x12, 0x7b, 0xb7, 0xfe, 0x88, 0xc8, 0xb5, 0x47, 0xb8, 0x20, 0x21, 0xf1, 0x9b, + 0x7a, 0xac, 0xc4, 0x85, 0x13, 0x42, 0x09, 0x3f, 0x04, 0x79, 0x3f, 0x52, 0x87, 0x26, 0xce, 0x2d, + 0x3b, 0xfb, 0xe6, 0xbd, 0xb7, 0x6f, 0x26, 0x86, 0x9d, 0x78, 0xe0, 0x87, 0xfd, 0x91, 0x13, 0x90, + 0xa8, 0x4f, 0x93, 0x80, 0x70, 0x67, 0xb8, 0xef, 0x9c, 0xa7, 0x34, 0x1a, 0xd9, 0x3c, 0x62, 0x09, + 0xc3, 0x1b, 0x12, 0x60, 0x4f, 0x01, 0xf6, 0x70, 0xbf, 0xb1, 0xe9, 0x31, 0x8f, 0x89, 0x7b, 0x27, + 0xfb, 0x25, 0xa1, 0x8d, 0x47, 0x1e, 0x63, 0xde, 0x80, 0x3a, 0x84, 0xfb, 0x0e, 0x09, 0x43, 0x96, + 0x90, 0xc4, 0x67, 0x61, 0xac, 0x6e, 0x9b, 0x4a, 0x29, 0x19, 0x71, 0x1a, 0x67, 0x2a, 0x6e, 0x1a, + 0x45, 0x34, 0x74, 0x47, 0x5d, 0x4e, 0xfc, 0x48, 0x81, 0xcc, 0x79, 0x76, 0xe4, 0xa1, 0x08, 0xc1, + 0x49, 0x44, 0x02, 0x25, 0x64, 0x61, 0xb8, 0x7f, 0x2c, 0x2e, 0x8f, 0x09, 0xef, 0xd0, 0xf3, 0x94, + 0xc6, 0x89, 0xf5, 0x03, 0xc1, 0x83, 0x5c, 0x31, 0xe6, 0x2c, 0x8c, 0x29, 0x3e, 0x04, 0x90, 0x34, + 0xdd, 0x80, 0xf0, 0x3a, 0x32, 0x51, 0xab, 0xda, 0x36, 0xec, 0x39, 0x0f, 0xb6, 0xa7, 0xbd, 0x07, + 0xab, 0x97, 0xbf, 0x77, 0x4a, 0x9d, 0x4a, 0xa0, 0x0b, 0x78, 0x17, 0xd6, 0x06, 0x24, 0x4e, 0xba, + 0x29, 0xef, 0x91, 0x84, 0xf6, 0xea, 0x2b, 0x26, 0x6a, 0xad, 0x76, 0xaa, 0x59, 0xed, 0x83, 0x2c, + 0xe1, 0x87, 0x70, 0xd7, 0x3d, 0x23, 0x7e, 0xd8, 0xf5, 0x7b, 0xf5, 0x5b, 0x26, 0x6a, 0x55, 0x3a, + 0x77, 0xc4, 0xf9, 0x6d, 0xcf, 0xfa, 0x08, 0x35, 0xc9, 0xad, 0x9c, 0xe2, 0x37, 0x50, 0x9b, 0x09, + 0x46, 0x34, 0x54, 0xdb, 0xdb, 0xda, 0x96, 0x88, 0x2f, 0xb3, 0x74, 0xa8, 0x50, 0x27, 0xc4, 0x8f, + 0x94, 0xab, 0x35, 0x37, 0x57, 0xb3, 0x8e, 0x60, 0x5d, 0x53, 0xab, 0xf7, 0xbe, 0x82, 0xb2, 0xf4, + 0xad, 0xde, 0xba, 0x55, 0xf0, 0x56, 0x45, 0xa9, 0x1a, 0xac, 0x7b, 0x50, 0x3b, 0x11, 0x21, 0xeb, + 0x44, 0x8f, 0x60, 0x5d, 0x17, 0xae, 0xd9, 0xe5, 0x1c, 0x0a, 0xd9, 0x65, 0x93, 0x66, 0x97, 0x0d, + 0xd6, 0x26, 0xe0, 0x77, 0xd7, 0x79, 0x69, 0x89, 0x97, 0xb0, 0x31, 0x53, 0x55, 0x3a, 0xff, 0x07, + 0x8e, 0x6e, 0x04, 0xde, 0xfe, 0xb2, 0x0a, 0xb7, 0xdf, 0x67, 0x4b, 0x8c, 0x2f, 0x10, 0x54, 0xa6, + 0xc3, 0xc3, 0x8f, 0x8b, 0x87, 0xab, 0x84, 0x1b, 0x7b, 0xcb, 0x60, 0xd2, 0x89, 0xb5, 0x77, 0xf1, + 0xf3, 0xef, 0xf7, 0x15, 0x13, 0x1b, 0xce, 0xe2, 0xb5, 0x0d, 0x08, 0xc7, 0x43, 0x28, 0xcb, 0x66, + 0x6c, 0x15, 0x30, 0x6b, 0xf5, 0x66, 0x21, 0x46, 0x49, 0x37, 0x85, 0xf4, 0x36, 0xde, 0x2a, 0x90, + 0xc6, 0x5f, 0x11, 0x54, 0x73, 0x09, 0xe2, 0x27, 0x73, 0x99, 0x6f, 0x26, 0xdf, 0x68, 0x2d, 0x07, + 0x2a, 0x1f, 0x4f, 0x85, 0x8f, 0x26, 0xde, 0x9d, 0xeb, 0x23, 0x3f, 0xa7, 0x2c, 0x05, 0x39, 0xfc, + 0x05, 0x29, 0xcc, 0xec, 0xd7, 0x82, 0x14, 0x66, 0x57, 0x6e, 0x49, 0x0a, 0x72, 0xb9, 0x0e, 0x5e, + 0x5f, 0x8e, 0x0d, 0x74, 0x35, 0x36, 0xd0, 0x9f, 0xb1, 0x81, 0xbe, 0x4d, 0x8c, 0xd2, 0xd5, 0xc4, + 0x28, 0xfd, 0x9a, 0x18, 0xa5, 0x4f, 0xcf, 0x3c, 0x3f, 0x39, 0x4b, 0x4f, 0x6d, 0x97, 0x05, 0x4e, + 0xdc, 0xf7, 0xf9, 0xf3, 0x80, 0x0e, 0x35, 0xd3, 0xe7, 0x1c, 0x97, 0xf8, 0xcf, 0x9d, 0x96, 0xc5, + 0xe7, 0xe5, 0xc5, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb4, 0xdd, 0xa3, 0x27, 0x33, 0x05, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -370,9 +461,12 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // MarketMap returns the full market map stored in the x/marketmap // module. - MarketMap(ctx context.Context, in *GetMarketMapRequest, opts ...grpc.CallOption) (*GetMarketMapResponse, error) + MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) + // Market returns a market stored in the x/marketmap + // module. + Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) // LastUpdated returns the last height the market map was updated at. - LastUpdated(ctx context.Context, in *GetLastUpdatedRequest, opts ...grpc.CallOption) (*GetLastUpdatedResponse, error) + LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) // Params returns the current x/marketmap module parameters. Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) } @@ -385,8 +479,8 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) MarketMap(ctx context.Context, in *GetMarketMapRequest, opts ...grpc.CallOption) (*GetMarketMapResponse, error) { - out := new(GetMarketMapResponse) +func (c *queryClient) MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) { + out := new(MarketMapResponse) err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Query/MarketMap", in, out, opts...) if err != nil { return nil, err @@ -394,8 +488,17 @@ func (c *queryClient) MarketMap(ctx context.Context, in *GetMarketMapRequest, op return out, nil } -func (c *queryClient) LastUpdated(ctx context.Context, in *GetLastUpdatedRequest, opts ...grpc.CallOption) (*GetLastUpdatedResponse, error) { - out := new(GetLastUpdatedResponse) +func (c *queryClient) Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) { + out := new(MarketResponse) + err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Query/Market", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *queryClient) LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) { + out := new(LastUpdatedResponse) err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Query/LastUpdated", in, out, opts...) if err != nil { return nil, err @@ -416,9 +519,12 @@ func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grp type QueryServer interface { // MarketMap returns the full market map stored in the x/marketmap // module. - MarketMap(context.Context, *GetMarketMapRequest) (*GetMarketMapResponse, error) + MarketMap(context.Context, *MarketMapRequest) (*MarketMapResponse, error) + // Market returns a market stored in the x/marketmap + // module. + Market(context.Context, *MarketRequest) (*MarketResponse, error) // LastUpdated returns the last height the market map was updated at. - LastUpdated(context.Context, *GetLastUpdatedRequest) (*GetLastUpdatedResponse, error) + LastUpdated(context.Context, *LastUpdatedRequest) (*LastUpdatedResponse, error) // Params returns the current x/marketmap module parameters. Params(context.Context, *ParamsRequest) (*ParamsResponse, error) } @@ -427,10 +533,13 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) MarketMap(ctx context.Context, req *GetMarketMapRequest) (*GetMarketMapResponse, error) { +func (*UnimplementedQueryServer) MarketMap(ctx context.Context, req *MarketMapRequest) (*MarketMapResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MarketMap not implemented") } -func (*UnimplementedQueryServer) LastUpdated(ctx context.Context, req *GetLastUpdatedRequest) (*GetLastUpdatedResponse, error) { +func (*UnimplementedQueryServer) Market(ctx context.Context, req *MarketRequest) (*MarketResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method Market not implemented") +} +func (*UnimplementedQueryServer) LastUpdated(ctx context.Context, req *LastUpdatedRequest) (*LastUpdatedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method LastUpdated not implemented") } func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { @@ -442,7 +551,7 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { } func _Query_MarketMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetMarketMapRequest) + in := new(MarketMapRequest) if err := dec(in); err != nil { return nil, err } @@ -454,13 +563,31 @@ func _Query_MarketMap_Handler(srv interface{}, ctx context.Context, dec func(int FullMethod: "/slinky.marketmap.v1.Query/MarketMap", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MarketMap(ctx, req.(*GetMarketMapRequest)) + return srv.(QueryServer).MarketMap(ctx, req.(*MarketMapRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _Query_Market_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MarketRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).Market(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/slinky.marketmap.v1.Query/Market", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).Market(ctx, req.(*MarketRequest)) } return interceptor(ctx, in, info, handler) } func _Query_LastUpdated_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(GetLastUpdatedRequest) + in := new(LastUpdatedRequest) if err := dec(in); err != nil { return nil, err } @@ -472,7 +599,7 @@ func _Query_LastUpdated_Handler(srv interface{}, ctx context.Context, dec func(i FullMethod: "/slinky.marketmap.v1.Query/LastUpdated", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastUpdated(ctx, req.(*GetLastUpdatedRequest)) + return srv.(QueryServer).LastUpdated(ctx, req.(*LastUpdatedRequest)) } return interceptor(ctx, in, info, handler) } @@ -503,6 +630,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "MarketMap", Handler: _Query_MarketMap_Handler, }, + { + MethodName: "Market", + Handler: _Query_Market_Handler, + }, { MethodName: "LastUpdated", Handler: _Query_LastUpdated_Handler, @@ -516,7 +647,7 @@ var _Query_serviceDesc = grpc.ServiceDesc{ Metadata: "slinky/marketmap/v1/query.proto", } -func (m *GetMarketMapRequest) Marshal() (dAtA []byte, err error) { +func (m *MarketMapRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -526,12 +657,12 @@ func (m *GetMarketMapRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetMarketMapRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *MarketMapRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetMarketMapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MarketMapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -539,7 +670,7 @@ func (m *GetMarketMapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GetMarketMapResponse) Marshal() (dAtA []byte, err error) { +func (m *MarketMapResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -549,12 +680,12 @@ func (m *GetMarketMapResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetMarketMapResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MarketMapResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetMarketMapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MarketMapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -564,12 +695,7 @@ func (m *GetMarketMapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.ChainId) i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) i-- - dAtA[i] = 0x22 - } - if m.Version != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.Version)) - i-- - dAtA[i] = 0x18 + dAtA[i] = 0x1a } if m.LastUpdated != 0 { i = encodeVarintQuery(dAtA, i, uint64(m.LastUpdated)) @@ -589,6 +715,72 @@ func (m *GetMarketMapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MarketRequest) 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 *MarketRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MarketRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.CurrencyPair.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + return len(dAtA) - i, nil +} + +func (m *MarketResponse) 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 *MarketResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MarketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Market.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *ParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -645,7 +837,7 @@ func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GetLastUpdatedRequest) Marshal() (dAtA []byte, err error) { +func (m *LastUpdatedRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -655,12 +847,12 @@ func (m *GetLastUpdatedRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetLastUpdatedRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *LastUpdatedRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetLastUpdatedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *LastUpdatedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -668,7 +860,7 @@ func (m *GetLastUpdatedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *GetLastUpdatedResponse) Marshal() (dAtA []byte, err error) { +func (m *LastUpdatedResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -678,12 +870,12 @@ func (m *GetLastUpdatedResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *GetLastUpdatedResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *LastUpdatedResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *GetLastUpdatedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *LastUpdatedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -707,7 +899,7 @@ func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *GetMarketMapRequest) Size() (n int) { +func (m *MarketMapRequest) Size() (n int) { if m == nil { return 0 } @@ -716,7 +908,7 @@ func (m *GetMarketMapRequest) Size() (n int) { return n } -func (m *GetMarketMapResponse) Size() (n int) { +func (m *MarketMapResponse) Size() (n int) { if m == nil { return 0 } @@ -727,9 +919,6 @@ func (m *GetMarketMapResponse) Size() (n int) { if m.LastUpdated != 0 { n += 1 + sovQuery(uint64(m.LastUpdated)) } - if m.Version != 0 { - n += 1 + sovQuery(uint64(m.Version)) - } l = len(m.ChainId) if l > 0 { n += 1 + l + sovQuery(uint64(l)) @@ -737,6 +926,28 @@ func (m *GetMarketMapResponse) Size() (n int) { return n } +func (m *MarketRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.CurrencyPair.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + +func (m *MarketResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Market.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func (m *ParamsRequest) Size() (n int) { if m == nil { return 0 @@ -757,7 +968,7 @@ func (m *ParamsResponse) Size() (n int) { return n } -func (m *GetLastUpdatedRequest) Size() (n int) { +func (m *LastUpdatedRequest) Size() (n int) { if m == nil { return 0 } @@ -766,7 +977,7 @@ func (m *GetLastUpdatedRequest) Size() (n int) { return n } -func (m *GetLastUpdatedResponse) Size() (n int) { +func (m *LastUpdatedResponse) Size() (n int) { if m == nil { return 0 } @@ -784,7 +995,7 @@ func sovQuery(x uint64) (n int) { func sozQuery(x uint64) (n int) { return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *GetMarketMapRequest) Unmarshal(dAtA []byte) error { +func (m *MarketMapRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -807,10 +1018,10 @@ func (m *GetMarketMapRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetMarketMapRequest: wiretype end group for non-group") + return fmt.Errorf("proto: MarketMapRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetMarketMapRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MarketMapRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -834,7 +1045,7 @@ func (m *GetMarketMapRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetMarketMapResponse) Unmarshal(dAtA []byte) error { +func (m *MarketMapResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -857,10 +1068,10 @@ func (m *GetMarketMapResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetMarketMapResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MarketMapResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetMarketMapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MarketMapResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -916,10 +1127,10 @@ func (m *GetMarketMapResponse) Unmarshal(dAtA []byte) error { } } case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) } - m.Version = 0 + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -929,16 +1140,79 @@ func (m *GetMarketMapResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Version |= uint64(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - case 4: + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ChainId = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MarketRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MarketRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MarketRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -948,23 +1222,107 @@ func (m *GetMarketMapResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.ChainId = string(dAtA[iNdEx:postIndex]) + if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MarketResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MarketResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MarketResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Market", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Market.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1120,7 +1478,7 @@ func (m *ParamsResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetLastUpdatedRequest) Unmarshal(dAtA []byte) error { +func (m *LastUpdatedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1143,10 +1501,10 @@ func (m *GetLastUpdatedRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetLastUpdatedRequest: wiretype end group for non-group") + return fmt.Errorf("proto: LastUpdatedRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetLastUpdatedRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LastUpdatedRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1170,7 +1528,7 @@ func (m *GetLastUpdatedRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *GetLastUpdatedResponse) Unmarshal(dAtA []byte) error { +func (m *LastUpdatedResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1193,10 +1551,10 @@ func (m *GetLastUpdatedResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GetLastUpdatedResponse: wiretype end group for non-group") + return fmt.Errorf("proto: LastUpdatedResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GetLastUpdatedResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LastUpdatedResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: diff --git a/x/marketmap/types/query.pb.gw.go b/x/marketmap/types/query.pb.gw.go index 0e00a1e6d..94675c023 100644 --- a/x/marketmap/types/query.pb.gw.go +++ b/x/marketmap/types/query.pb.gw.go @@ -34,7 +34,7 @@ var _ = descriptor.ForMessage var _ = metadata.Join func request_Query_MarketMap_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetMarketMapRequest + var protoReq MarketMapRequest var metadata runtime.ServerMetadata msg, err := client.MarketMap(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -43,7 +43,7 @@ func request_Query_MarketMap_0(ctx context.Context, marshaler runtime.Marshaler, } func local_request_Query_MarketMap_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetMarketMapRequest + var protoReq MarketMapRequest var metadata runtime.ServerMetadata msg, err := server.MarketMap(ctx, &protoReq) @@ -51,8 +51,44 @@ func local_request_Query_MarketMap_0(ctx context.Context, marshaler runtime.Mars } +var ( + filter_Query_Market_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_Query_Market_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MarketRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Market_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.Market(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_Market_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq MarketRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Market_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.Market(ctx, &protoReq) + return msg, metadata, err + +} + func request_Query_LastUpdated_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetLastUpdatedRequest + var protoReq LastUpdatedRequest var metadata runtime.ServerMetadata msg, err := client.LastUpdated(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -61,7 +97,7 @@ func request_Query_LastUpdated_0(ctx context.Context, marshaler runtime.Marshale } func local_request_Query_LastUpdated_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq GetLastUpdatedRequest + var protoReq LastUpdatedRequest var metadata runtime.ServerMetadata msg, err := server.LastUpdated(ctx, &protoReq) @@ -116,6 +152,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_Market_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_Market_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Market_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_LastUpdated_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -223,6 +282,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_Market_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_Market_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_Market_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + mux.Handle("GET", pattern_Query_LastUpdated_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -269,6 +348,8 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie var ( pattern_Query_MarketMap_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 1}, []string{"slinky", "marketmap", "v1"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_Market_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "marketmap", "v1", "market"}, "", runtime.AssumeColonVerbOpt(false))) + pattern_Query_LastUpdated_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "marketmap", "v1", "last_updated"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "marketmap", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) @@ -277,6 +358,8 @@ var ( var ( forward_Query_MarketMap_0 = runtime.ForwardResponseMessage + forward_Query_Market_0 = runtime.ForwardResponseMessage + forward_Query_LastUpdated_0 = runtime.ForwardResponseMessage forward_Query_Params_0 = runtime.ForwardResponseMessage diff --git a/x/marketmap/types/ticker.go b/x/marketmap/types/ticker.go index 7c3be4c8a..f3cfcf64a 100644 --- a/x/marketmap/types/ticker.go +++ b/x/marketmap/types/ticker.go @@ -15,8 +15,6 @@ const ( // DefaultMinProviderCount is the minimum number of providers required for a // ticker to be considered valid. DefaultMinProviderCount = 1 - // MaxPathLength is the maximum length of a path for a ticker conversion. - MaxPathLength = 3 // MaxMetadataJSONFieldLength is the maximum length of the MetadataJSON field. MaxMetadataJSONFieldLength = 16384 ) @@ -58,7 +56,7 @@ func (t *Ticker) ValidateBasic() error { } if err := json.IsValid([]byte(t.Metadata_JSON)); err != nil { - return fmt.Errorf("invalid JSON metadata; %w", err) + return fmt.Errorf("invalid ticker metadata json: %w", err) } return nil diff --git a/x/marketmap/types/ticker_test.go b/x/marketmap/types/ticker_test.go index 1716a8e48..3a7f0fe6a 100644 --- a/x/marketmap/types/ticker_test.go +++ b/x/marketmap/types/ticker_test.go @@ -26,22 +26,10 @@ func TestTicker(t *testing.T) { }, Decimals: 8, MinProviderCount: 1, + Metadata_JSON: "", }, expErr: false, }, - { - name: "invalid metadata length", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: testutil.RandomString(types.MaxMetadataJSONFieldLength + 1), - }, - expErr: true, - }, { name: "empty base", ticker: types.Ticker{ @@ -51,6 +39,7 @@ func TestTicker(t *testing.T) { }, Decimals: 8, MinProviderCount: 1, + Metadata_JSON: "", }, expErr: true, }, @@ -63,6 +52,7 @@ func TestTicker(t *testing.T) { }, Decimals: 8, MinProviderCount: 1, + Metadata_JSON: "", }, expErr: true, }, @@ -75,6 +65,7 @@ func TestTicker(t *testing.T) { }, Decimals: 8, MinProviderCount: 1, + Metadata_JSON: "", }, expErr: true, }, @@ -87,6 +78,7 @@ func TestTicker(t *testing.T) { }, Decimals: 8, MinProviderCount: 1, + Metadata_JSON: "", }, expErr: true, }, @@ -99,6 +91,7 @@ func TestTicker(t *testing.T) { }, Decimals: 0, MinProviderCount: 1, + Metadata_JSON: "", }, expErr: true, }, @@ -111,6 +104,33 @@ func TestTicker(t *testing.T) { }, Decimals: 8, MinProviderCount: 0, + Metadata_JSON: "", + }, + expErr: true, + }, + { + name: "invalid json len", + ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "BITCOIN", + Quote: "USDT", + }, + Decimals: 8, + MinProviderCount: 0, + Metadata_JSON: testutil.RandomString(types.MaxMetadataJSONFieldLength + 1), + }, + expErr: true, + }, + { + name: "invalid json", + ticker: types.Ticker{ + CurrencyPair: slinkytypes.CurrencyPair{ + Base: "BITCOIN", + Quote: "USDT", + }, + Decimals: 8, + MinProviderCount: 0, + Metadata_JSON: "invalid", }, expErr: true, }, diff --git a/x/marketmap/types/tx.pb.go b/x/marketmap/types/tx.pb.go index 111db8858..5b8fa68d3 100644 --- a/x/marketmap/types/tx.pb.go +++ b/x/marketmap/types/tx.pb.go @@ -31,31 +31,29 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// CreateMarket contains all information needed to create a new market. -type CreateMarket struct { - // Ticker is the on-chain representation of the ticker. This is the target - // ticker that the prices of the set of tickers will be converted to. - Ticker Ticker `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker"` - // Providers maps provider names to their off-chain - // representations for the given ticker of the message. - Providers Providers `protobuf:"bytes,2,opt,name=providers,proto3" json:"providers"` - // Paths is the list of convertable markets that will be used to convert the - // prices of a set of tickers to a common ticker. - Paths Paths `protobuf:"bytes,3,opt,name=paths,proto3" json:"paths"` -} - -func (m *CreateMarket) Reset() { *m = CreateMarket{} } -func (m *CreateMarket) String() string { return proto.CompactTextString(m) } -func (*CreateMarket) ProtoMessage() {} -func (*CreateMarket) Descriptor() ([]byte, []int) { +// MsgCreateMarkets defines a message carrying a payload for creating markets in +// the x/marketmap module. +type MsgCreateMarkets struct { + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // CreateMarkets is the list of all markets to be created for the given + // transaction. + CreateMarkets []Market `protobuf:"bytes,2,rep,name=create_markets,json=createMarkets,proto3" json:"create_markets"` +} + +func (m *MsgCreateMarkets) Reset() { *m = MsgCreateMarkets{} } +func (m *MsgCreateMarkets) String() string { return proto.CompactTextString(m) } +func (*MsgCreateMarkets) ProtoMessage() {} +func (*MsgCreateMarkets) Descriptor() ([]byte, []int) { return fileDescriptor_e9adadfc18297083, []int{0} } -func (m *CreateMarket) XXX_Unmarshal(b []byte) error { +func (m *MsgCreateMarkets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *CreateMarket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgCreateMarkets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_CreateMarket.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgCreateMarkets.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -65,61 +63,92 @@ func (m *CreateMarket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) return b[:n], nil } } -func (m *CreateMarket) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateMarket.Merge(m, src) +func (m *MsgCreateMarkets) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateMarkets.Merge(m, src) } -func (m *CreateMarket) XXX_Size() int { +func (m *MsgCreateMarkets) XXX_Size() int { return m.Size() } -func (m *CreateMarket) XXX_DiscardUnknown() { - xxx_messageInfo_CreateMarket.DiscardUnknown(m) +func (m *MsgCreateMarkets) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateMarkets.DiscardUnknown(m) } -var xxx_messageInfo_CreateMarket proto.InternalMessageInfo +var xxx_messageInfo_MsgCreateMarkets proto.InternalMessageInfo -func (m *CreateMarket) GetTicker() Ticker { +func (m *MsgCreateMarkets) GetAuthority() string { if m != nil { - return m.Ticker + return m.Authority } - return Ticker{} + return "" } -func (m *CreateMarket) GetProviders() Providers { +func (m *MsgCreateMarkets) GetCreateMarkets() []Market { if m != nil { - return m.Providers + return m.CreateMarkets } - return Providers{} + return nil } -func (m *CreateMarket) GetPaths() Paths { - if m != nil { - return m.Paths +// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. +type MsgCreateMarketsResponse struct { +} + +func (m *MsgCreateMarketsResponse) Reset() { *m = MsgCreateMarketsResponse{} } +func (m *MsgCreateMarketsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateMarketsResponse) ProtoMessage() {} +func (*MsgCreateMarketsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9adadfc18297083, []int{1} +} +func (m *MsgCreateMarketsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateMarketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateMarketsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil } - return Paths{} +} +func (m *MsgCreateMarketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateMarketsResponse.Merge(m, src) +} +func (m *MsgCreateMarketsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateMarketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateMarketsResponse.DiscardUnknown(m) } -// MsgUpdateMarketMap defines a message carrying a payload for updating the +var xxx_messageInfo_MsgCreateMarketsResponse proto.InternalMessageInfo + +// MsgUpdateMarkets defines a message carrying a payload for updating the // x/marketmap module. -type MsgUpdateMarketMap struct { - // Signer is the signer of this transaction. - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` - // CreateMarkets is the list of all markets to be created for the given +type MsgUpdateMarkets struct { + // Authority is the signer of this transaction. This authority must be + // authorized by the module to execute the message. + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // UpdateMarkets is the list of all markets to be updated for the given // transaction. - CreateMarkets []CreateMarket `protobuf:"bytes,2,rep,name=create_markets,json=createMarkets,proto3" json:"create_markets"` + UpdateMarkets []Market `protobuf:"bytes,2,rep,name=update_markets,json=updateMarkets,proto3" json:"update_markets"` } -func (m *MsgUpdateMarketMap) Reset() { *m = MsgUpdateMarketMap{} } -func (m *MsgUpdateMarketMap) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateMarketMap) ProtoMessage() {} -func (*MsgUpdateMarketMap) Descriptor() ([]byte, []int) { - return fileDescriptor_e9adadfc18297083, []int{1} +func (m *MsgUpdateMarkets) Reset() { *m = MsgUpdateMarkets{} } +func (m *MsgUpdateMarkets) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMarkets) ProtoMessage() {} +func (*MsgUpdateMarkets) Descriptor() ([]byte, []int) { + return fileDescriptor_e9adadfc18297083, []int{2} } -func (m *MsgUpdateMarketMap) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateMarkets) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateMarketMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateMarkets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateMarketMap.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateMarkets.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -129,48 +158,48 @@ func (m *MsgUpdateMarketMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, return b[:n], nil } } -func (m *MsgUpdateMarketMap) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateMarketMap.Merge(m, src) +func (m *MsgUpdateMarkets) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMarkets.Merge(m, src) } -func (m *MsgUpdateMarketMap) XXX_Size() int { +func (m *MsgUpdateMarkets) XXX_Size() int { return m.Size() } -func (m *MsgUpdateMarketMap) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateMarketMap.DiscardUnknown(m) +func (m *MsgUpdateMarkets) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMarkets.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateMarketMap proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateMarkets proto.InternalMessageInfo -func (m *MsgUpdateMarketMap) GetSigner() string { +func (m *MsgUpdateMarkets) GetAuthority() string { if m != nil { - return m.Signer + return m.Authority } return "" } -func (m *MsgUpdateMarketMap) GetCreateMarkets() []CreateMarket { +func (m *MsgUpdateMarkets) GetUpdateMarkets() []Market { if m != nil { - return m.CreateMarkets + return m.UpdateMarkets } return nil } -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -type MsgUpdateMarketMapResponse struct { +// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. +type MsgUpdateMarketsResponse struct { } -func (m *MsgUpdateMarketMapResponse) Reset() { *m = MsgUpdateMarketMapResponse{} } -func (m *MsgUpdateMarketMapResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateMarketMapResponse) ProtoMessage() {} -func (*MsgUpdateMarketMapResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e9adadfc18297083, []int{2} +func (m *MsgUpdateMarketsResponse) Reset() { *m = MsgUpdateMarketsResponse{} } +func (m *MsgUpdateMarketsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateMarketsResponse) ProtoMessage() {} +func (*MsgUpdateMarketsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9adadfc18297083, []int{3} } -func (m *MsgUpdateMarketMapResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateMarketsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgUpdateMarketMapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateMarketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgUpdateMarketMapResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateMarketsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -180,17 +209,17 @@ func (m *MsgUpdateMarketMapResponse) XXX_Marshal(b []byte, deterministic bool) ( return b[:n], nil } } -func (m *MsgUpdateMarketMapResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateMarketMapResponse.Merge(m, src) +func (m *MsgUpdateMarketsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateMarketsResponse.Merge(m, src) } -func (m *MsgUpdateMarketMapResponse) XXX_Size() int { +func (m *MsgUpdateMarketsResponse) XXX_Size() int { return m.Size() } -func (m *MsgUpdateMarketMapResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateMarketMapResponse.DiscardUnknown(m) +func (m *MsgUpdateMarketsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateMarketsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgUpdateMarketMapResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateMarketsResponse proto.InternalMessageInfo // MsgParams defines the Msg/Params request type. It contains the // new parameters for the x/marketmap module. @@ -206,7 +235,7 @@ func (m *MsgParams) Reset() { *m = MsgParams{} } func (m *MsgParams) String() string { return proto.CompactTextString(m) } func (*MsgParams) ProtoMessage() {} func (*MsgParams) Descriptor() ([]byte, []int) { - return fileDescriptor_e9adadfc18297083, []int{3} + return fileDescriptor_e9adadfc18297083, []int{4} } func (m *MsgParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -257,7 +286,7 @@ func (m *MsgParamsResponse) Reset() { *m = MsgParamsResponse{} } func (m *MsgParamsResponse) String() string { return proto.CompactTextString(m) } func (*MsgParamsResponse) ProtoMessage() {} func (*MsgParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_e9adadfc18297083, []int{4} + return fileDescriptor_e9adadfc18297083, []int{5} } func (m *MsgParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -286,51 +315,152 @@ func (m *MsgParamsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgParamsResponse proto.InternalMessageInfo +// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse +// request type. It contains the new addresses to remove from the list of +// authorities +type MsgRemoveMarketAuthorities struct { + // RemoveAddresses is the list of addresses to remove. + RemoveAddresses []string `protobuf:"bytes,1,rep,name=remove_addresses,json=removeAddresses,proto3" json:"remove_addresses,omitempty"` + // Admin defines the authority that is the x/marketmap + // Admin account. This account is set in the module parameters. + Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` +} + +func (m *MsgRemoveMarketAuthorities) Reset() { *m = MsgRemoveMarketAuthorities{} } +func (m *MsgRemoveMarketAuthorities) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMarketAuthorities) ProtoMessage() {} +func (*MsgRemoveMarketAuthorities) Descriptor() ([]byte, []int) { + return fileDescriptor_e9adadfc18297083, []int{6} +} +func (m *MsgRemoveMarketAuthorities) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveMarketAuthorities) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveMarketAuthorities.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 *MsgRemoveMarketAuthorities) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMarketAuthorities.Merge(m, src) +} +func (m *MsgRemoveMarketAuthorities) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveMarketAuthorities) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMarketAuthorities.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveMarketAuthorities proto.InternalMessageInfo + +func (m *MsgRemoveMarketAuthorities) GetRemoveAddresses() []string { + if m != nil { + return m.RemoveAddresses + } + return nil +} + +func (m *MsgRemoveMarketAuthorities) GetAdmin() string { + if m != nil { + return m.Admin + } + return "" +} + +// MsgRemoveMarketAuthoritiesResponse defines the +// Msg/RemoveMarketAuthoritiesResponse response type. +type MsgRemoveMarketAuthoritiesResponse struct { +} + +func (m *MsgRemoveMarketAuthoritiesResponse) Reset() { *m = MsgRemoveMarketAuthoritiesResponse{} } +func (m *MsgRemoveMarketAuthoritiesResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveMarketAuthoritiesResponse) ProtoMessage() {} +func (*MsgRemoveMarketAuthoritiesResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_e9adadfc18297083, []int{7} +} +func (m *MsgRemoveMarketAuthoritiesResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgRemoveMarketAuthoritiesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse.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 *MsgRemoveMarketAuthoritiesResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse.Merge(m, src) +} +func (m *MsgRemoveMarketAuthoritiesResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgRemoveMarketAuthoritiesResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse proto.InternalMessageInfo + func init() { - proto.RegisterType((*CreateMarket)(nil), "slinky.marketmap.v1.CreateMarket") - proto.RegisterType((*MsgUpdateMarketMap)(nil), "slinky.marketmap.v1.MsgUpdateMarketMap") - proto.RegisterType((*MsgUpdateMarketMapResponse)(nil), "slinky.marketmap.v1.MsgUpdateMarketMapResponse") + proto.RegisterType((*MsgCreateMarkets)(nil), "slinky.marketmap.v1.MsgCreateMarkets") + proto.RegisterType((*MsgCreateMarketsResponse)(nil), "slinky.marketmap.v1.MsgCreateMarketsResponse") + proto.RegisterType((*MsgUpdateMarkets)(nil), "slinky.marketmap.v1.MsgUpdateMarkets") + proto.RegisterType((*MsgUpdateMarketsResponse)(nil), "slinky.marketmap.v1.MsgUpdateMarketsResponse") proto.RegisterType((*MsgParams)(nil), "slinky.marketmap.v1.MsgParams") proto.RegisterType((*MsgParamsResponse)(nil), "slinky.marketmap.v1.MsgParamsResponse") + proto.RegisterType((*MsgRemoveMarketAuthorities)(nil), "slinky.marketmap.v1.MsgRemoveMarketAuthorities") + proto.RegisterType((*MsgRemoveMarketAuthoritiesResponse)(nil), "slinky.marketmap.v1.MsgRemoveMarketAuthoritiesResponse") } func init() { proto.RegisterFile("slinky/marketmap/v1/tx.proto", fileDescriptor_e9adadfc18297083) } var fileDescriptor_e9adadfc18297083 = []byte{ - // 515 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xc1, 0x6a, 0x13, 0x41, - 0x18, 0xc7, 0x77, 0x8c, 0x0d, 0x64, 0xaa, 0x95, 0x4e, 0x0b, 0xc6, 0xb5, 0x6c, 0xeb, 0x82, 0x5a, - 0x82, 0xdd, 0xb5, 0x11, 0x0a, 0xed, 0xcd, 0x08, 0xde, 0x56, 0x42, 0xd4, 0x8b, 0x97, 0xb2, 0xdd, - 0x0c, 0x93, 0x65, 0xdd, 0x9d, 0x61, 0x66, 0x1a, 0x9a, 0x9b, 0x78, 0xf4, 0x20, 0x3e, 0x82, 0x8f, - 0x90, 0x83, 0xaf, 0x20, 0x14, 0xbc, 0x44, 0x4f, 0x9e, 0x44, 0x92, 0x43, 0x7c, 0x0c, 0xd9, 0x99, - 0xd9, 0x24, 0x98, 0x35, 0xf4, 0x12, 0x76, 0xbe, 0xef, 0xf7, 0x9f, 0xf9, 0x7f, 0xdf, 0x9f, 0xc0, - 0x1d, 0xf1, 0x36, 0xce, 0x92, 0x81, 0x9f, 0x86, 0x3c, 0xc1, 0x32, 0x0d, 0x99, 0xdf, 0x3f, 0xf4, - 0xe5, 0x85, 0xc7, 0x38, 0x95, 0x14, 0x6d, 0xe9, 0xae, 0x37, 0xeb, 0x7a, 0xfd, 0x43, 0xfb, 0x76, - 0x44, 0x45, 0x4a, 0x85, 0x9f, 0x0a, 0x92, 0xc3, 0xa9, 0x20, 0x9a, 0xb6, 0xb7, 0x09, 0x25, 0x54, - 0x7d, 0xfa, 0xf9, 0x97, 0xa9, 0xde, 0xd1, 0xf8, 0xa9, 0x6e, 0xe8, 0x83, 0x69, 0x6d, 0x86, 0x69, - 0x9c, 0x51, 0x5f, 0xfd, 0x9a, 0xd2, 0x5e, 0x99, 0x1f, 0x7d, 0x58, 0x45, 0xb0, 0x90, 0x87, 0xa9, - 0xb9, 0xd6, 0xfd, 0x0a, 0xe0, 0x8d, 0x67, 0x1c, 0x87, 0x12, 0x07, 0x8a, 0x41, 0xc7, 0xb0, 0x2a, - 0xe3, 0x28, 0xc1, 0xbc, 0x0e, 0xf6, 0xc0, 0xfe, 0x7a, 0xf3, 0xae, 0x57, 0x32, 0x97, 0xf7, 0x4a, - 0x21, 0xad, 0xeb, 0x97, 0xbf, 0x76, 0xad, 0x8e, 0x11, 0xa0, 0x16, 0xac, 0x31, 0x4e, 0xfb, 0x71, - 0x17, 0x73, 0x51, 0xbf, 0xa6, 0xd4, 0x4e, 0xa9, 0xba, 0x5d, 0x50, 0xe6, 0x82, 0xb9, 0x0c, 0x1d, - 0xc1, 0x35, 0x16, 0xca, 0x9e, 0xa8, 0x57, 0x94, 0xde, 0x2e, 0xd7, 0xe7, 0x84, 0xd1, 0x6a, 0xdc, - 0xfd, 0x0e, 0x20, 0x0a, 0x04, 0x79, 0xcd, 0xba, 0xb3, 0x51, 0x82, 0x90, 0xa1, 0xc7, 0xb0, 0x2a, - 0x62, 0x92, 0x99, 0x69, 0x6a, 0xad, 0xfa, 0x8f, 0x2f, 0x07, 0xdb, 0x66, 0xaf, 0x4f, 0xbb, 0x5d, - 0x8e, 0x85, 0x78, 0x29, 0x79, 0x9c, 0x91, 0x8e, 0xe1, 0xd0, 0x0b, 0xb8, 0x11, 0xa9, 0x7d, 0x9c, - 0xea, 0x27, 0xf3, 0x49, 0x2a, 0xfb, 0xeb, 0xcd, 0x7b, 0xa5, 0x4e, 0x16, 0x57, 0x67, 0x0c, 0xdd, - 0x8c, 0x16, 0x6a, 0xe2, 0xe4, 0xf8, 0xcf, 0xe7, 0x5d, 0xeb, 0xfd, 0x74, 0xd8, 0x30, 0x0f, 0x7c, - 0x98, 0x0e, 0x1b, 0xf7, 0x4d, 0x2c, 0x17, 0x0b, 0xc1, 0x2c, 0x9b, 0x77, 0x77, 0xa0, 0xbd, 0x5c, - 0xed, 0x60, 0xc1, 0x68, 0x26, 0xb0, 0xfb, 0x11, 0xc0, 0x5a, 0x20, 0x48, 0x5b, 0xa5, 0x99, 0xc7, - 0xa6, 0x73, 0x5d, 0x19, 0x9b, 0x86, 0x8b, 0xd8, 0xb4, 0x00, 0x1d, 0xc1, 0x5a, 0x78, 0x2e, 0x7b, - 0x94, 0xc7, 0x72, 0xa0, 0x62, 0x5b, 0xb5, 0xa6, 0x39, 0x7a, 0xb2, 0x91, 0x4f, 0x35, 0x3f, 0xbb, - 0x5b, 0x70, 0x73, 0xe6, 0xa7, 0x70, 0xd9, 0xfc, 0x06, 0x60, 0x25, 0x10, 0x04, 0x25, 0xf0, 0xd6, - 0xbf, 0xd9, 0x3c, 0x2c, 0xb5, 0xb8, 0x3c, 0xb1, 0xed, 0x5f, 0x11, 0x2c, 0x1e, 0x45, 0x6d, 0x58, - 0x35, 0x6b, 0x71, 0xfe, 0x27, 0xd5, 0x7d, 0xfb, 0xc1, 0xea, 0x7e, 0x71, 0xa3, 0xbd, 0xf6, 0x6e, - 0x3a, 0x6c, 0x80, 0xd6, 0xf3, 0xcb, 0xb1, 0x03, 0x46, 0x63, 0x07, 0xfc, 0x1e, 0x3b, 0xe0, 0xd3, - 0xc4, 0xb1, 0x46, 0x13, 0xc7, 0xfa, 0x39, 0x71, 0xac, 0x37, 0x8f, 0x48, 0x2c, 0x7b, 0xe7, 0x67, - 0x5e, 0x44, 0x53, 0x5f, 0x24, 0x31, 0x3b, 0x48, 0x71, 0xdf, 0x2f, 0x89, 0x59, 0x0e, 0x18, 0x16, - 0x67, 0x55, 0xf5, 0xe7, 0x7b, 0xf2, 0x37, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x70, 0x1d, 0x7a, 0x52, - 0x04, 0x00, 0x00, + // 559 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x94, 0x4d, 0x6b, 0x13, 0x41, + 0x18, 0xc7, 0x77, 0x1a, 0x1b, 0xc8, 0x48, 0x6b, 0xbb, 0x2d, 0x34, 0xae, 0xb2, 0x0d, 0xeb, 0x0b, + 0x31, 0x98, 0x5d, 0x5a, 0x41, 0x31, 0xb7, 0x44, 0x10, 0x2f, 0x0b, 0x65, 0xc5, 0x8b, 0x97, 0xb0, + 0x4d, 0x86, 0xe9, 0x12, 0x67, 0x67, 0xd9, 0xd9, 0x84, 0xe6, 0x26, 0xf6, 0xe6, 0x41, 0xfc, 0x08, + 0x7e, 0x84, 0x20, 0x7e, 0x88, 0x1e, 0x83, 0x27, 0x4f, 0x22, 0xc9, 0x21, 0x7e, 0x0c, 0xd9, 0x99, + 0xd9, 0x6d, 0x36, 0xec, 0xd6, 0x56, 0xbc, 0x84, 0xd9, 0xe7, 0xf9, 0x3f, 0xcf, 0xf3, 0xfb, 0xcf, + 0x4b, 0xe0, 0x5d, 0xf6, 0xce, 0xf3, 0x07, 0x63, 0x8b, 0xb8, 0xe1, 0x00, 0x45, 0xc4, 0x0d, 0xac, + 0xd1, 0x81, 0x15, 0x9d, 0x9a, 0x41, 0x48, 0x23, 0xaa, 0xee, 0x88, 0xac, 0x99, 0x66, 0xcd, 0xd1, + 0x81, 0xb6, 0xd7, 0xa3, 0x8c, 0x50, 0x66, 0x11, 0x86, 0x63, 0x31, 0x61, 0x58, 0xa8, 0xb5, 0x5d, + 0x4c, 0x31, 0xe5, 0x4b, 0x2b, 0x5e, 0xc9, 0xe8, 0x6d, 0x21, 0xef, 0x8a, 0x84, 0xf8, 0x90, 0xa9, + 0x6d, 0x97, 0x78, 0x3e, 0xb5, 0xf8, 0xaf, 0x0c, 0xd5, 0xf2, 0x78, 0xc4, 0xc7, 0x65, 0x8a, 0xc0, + 0x0d, 0x5d, 0x22, 0xdb, 0x1a, 0x53, 0x00, 0xb7, 0x6c, 0x86, 0x5f, 0x84, 0xc8, 0x8d, 0x90, 0xcd, + 0x65, 0x4c, 0x7d, 0x0a, 0x2b, 0xee, 0x30, 0x3a, 0xa1, 0xa1, 0x17, 0x8d, 0xab, 0xa0, 0x06, 0xea, + 0x95, 0x4e, 0xf5, 0xfb, 0xb7, 0xe6, 0xae, 0x04, 0x6a, 0xf7, 0xfb, 0x21, 0x62, 0xec, 0x75, 0x14, + 0x7a, 0x3e, 0x76, 0x2e, 0xa4, 0xea, 0x2b, 0xb8, 0xd9, 0xe3, 0x8d, 0xba, 0x62, 0x20, 0xab, 0xae, + 0xd5, 0x4a, 0xf5, 0x9b, 0x87, 0x77, 0xcc, 0x9c, 0xbd, 0x31, 0xc5, 0xb4, 0xce, 0x8d, 0xf3, 0x9f, + 0xfb, 0x8a, 0xb3, 0xd1, 0x5b, 0x26, 0x68, 0xb5, 0x7e, 0x7f, 0xd9, 0x57, 0x3e, 0x2c, 0x26, 0x8d, + 0x8b, 0xee, 0x1f, 0x17, 0x93, 0xc6, 0x3d, 0xe9, 0xe7, 0x74, 0xc9, 0xd1, 0x2a, 0xbd, 0xa1, 0xc1, + 0xea, 0x6a, 0xcc, 0x41, 0x2c, 0xa0, 0x3e, 0x43, 0x89, 0xdd, 0x37, 0x41, 0xff, 0xff, 0xd8, 0x1d, + 0xf2, 0x46, 0xff, 0x60, 0x77, 0xb8, 0x4c, 0x70, 0x4d, 0xbb, 0x19, 0x7a, 0x69, 0x37, 0x13, 0x4b, + 0xed, 0x7e, 0x02, 0xb0, 0x62, 0x33, 0x7c, 0xc4, 0x4f, 0x5c, 0x7d, 0x0e, 0xcb, 0xe2, 0xec, 0xb9, + 0xc9, 0x22, 0x4e, 0x21, 0x96, 0x9c, 0xb2, 0x20, 0xbb, 0x45, 0x6b, 0x57, 0xde, 0xa2, 0xd6, 0x66, + 0xd6, 0x94, 0xb1, 0x03, 0xb7, 0x53, 0x9e, 0x94, 0xf2, 0x0c, 0x40, 0xcd, 0x66, 0xd8, 0x41, 0x84, + 0x8e, 0xa4, 0x85, 0xb6, 0xac, 0xf0, 0x10, 0x53, 0x1f, 0xc1, 0xad, 0x90, 0xa7, 0xba, 0xae, 0x18, + 0x83, 0x62, 0x03, 0xa5, 0x7a, 0xc5, 0xb9, 0x25, 0xe2, 0xed, 0x24, 0xac, 0x9a, 0x70, 0xdd, 0xed, + 0x13, 0xcf, 0xff, 0x2b, 0xa2, 0x90, 0xb5, 0x60, 0x8c, 0x27, 0xd6, 0xc6, 0x7d, 0x68, 0x14, 0x43, + 0x24, 0xac, 0x87, 0x5f, 0x4b, 0xb0, 0x64, 0x33, 0xac, 0x22, 0xb8, 0x91, 0x7d, 0x33, 0x0f, 0xf2, + 0x0f, 0x7d, 0xe5, 0x22, 0x6a, 0xcd, 0x2b, 0xc9, 0x92, 0x71, 0xf1, 0x98, 0xec, 0x5d, 0x2d, 0x1c, + 0x93, 0x91, 0x15, 0x8f, 0xc9, 0xbd, 0x27, 0xea, 0x11, 0x2c, 0xcb, 0x3b, 0xa2, 0x17, 0x15, 0x8a, + 0xbc, 0xf6, 0xf0, 0xf2, 0x7c, 0xda, 0xf1, 0x0c, 0xc0, 0xbd, 0xa2, 0x03, 0xb5, 0x8a, 0x7a, 0x14, + 0x14, 0x68, 0xcf, 0xae, 0x59, 0x90, 0x50, 0x68, 0xeb, 0xef, 0x17, 0x93, 0x06, 0xe8, 0xbc, 0x3c, + 0x9f, 0xe9, 0x60, 0x3a, 0xd3, 0xc1, 0xaf, 0x99, 0x0e, 0x3e, 0xcf, 0x75, 0x65, 0x3a, 0xd7, 0x95, + 0x1f, 0x73, 0x5d, 0x79, 0xfb, 0x18, 0x7b, 0xd1, 0xc9, 0xf0, 0xd8, 0xec, 0x51, 0x62, 0xb1, 0x81, + 0x17, 0x34, 0x09, 0x1a, 0x59, 0x39, 0xaf, 0x2e, 0x1a, 0x07, 0x88, 0x1d, 0x97, 0xf9, 0x7f, 0xe6, + 0x93, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x17, 0x47, 0xc7, 0xa9, 0x09, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -345,10 +475,15 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { - // UpdateMarketMap creates markets from the given message. - UpdateMarketMap(ctx context.Context, in *MsgUpdateMarketMap, opts ...grpc.CallOption) (*MsgUpdateMarketMapResponse, error) + // CreateMarkets creates markets from the given message. + CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) + // UpdateMarkets updates markets from the given message. + UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) // Params defines a method for updating the x/marketmap module parameters. Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) + // RemoveMarketAuthorities defines a method for removing market authorities + // from the x/marketmap module. the signer must be the admin. + RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) } type msgClient struct { @@ -359,9 +494,18 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) UpdateMarketMap(ctx context.Context, in *MsgUpdateMarketMap, opts ...grpc.CallOption) (*MsgUpdateMarketMapResponse, error) { - out := new(MsgUpdateMarketMapResponse) - err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Msg/UpdateMarketMap", in, out, opts...) +func (c *msgClient) CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) { + out := new(MsgCreateMarketsResponse) + err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Msg/CreateMarkets", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) { + out := new(MsgUpdateMarketsResponse) + err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Msg/UpdateMarkets", in, out, opts...) if err != nil { return nil, err } @@ -377,43 +521,81 @@ func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.Call return out, nil } +func (c *msgClient) RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) { + out := new(MsgRemoveMarketAuthoritiesResponse) + err := c.cc.Invoke(ctx, "/slinky.marketmap.v1.Msg/RemoveMarketAuthorities", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { - // UpdateMarketMap creates markets from the given message. - UpdateMarketMap(context.Context, *MsgUpdateMarketMap) (*MsgUpdateMarketMapResponse, error) + // CreateMarkets creates markets from the given message. + CreateMarkets(context.Context, *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) + // UpdateMarkets updates markets from the given message. + UpdateMarkets(context.Context, *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) // Params defines a method for updating the x/marketmap module parameters. Params(context.Context, *MsgParams) (*MsgParamsResponse, error) + // RemoveMarketAuthorities defines a method for removing market authorities + // from the x/marketmap module. the signer must be the admin. + RemoveMarketAuthorities(context.Context, *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) UpdateMarketMap(ctx context.Context, req *MsgUpdateMarketMap) (*MsgUpdateMarketMapResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateMarketMap not implemented") +func (*UnimplementedMsgServer) CreateMarkets(ctx context.Context, req *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateMarkets not implemented") +} +func (*UnimplementedMsgServer) UpdateMarkets(ctx context.Context, req *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMarkets not implemented") } func (*UnimplementedMsgServer) Params(ctx context.Context, req *MsgParams) (*MsgParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } +func (*UnimplementedMsgServer) RemoveMarketAuthorities(ctx context.Context, req *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveMarketAuthorities not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_UpdateMarketMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateMarketMap) +func _Msg_CreateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateMarkets) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).UpdateMarketMap(ctx, in) + return srv.(MsgServer).CreateMarkets(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/slinky.marketmap.v1.Msg/UpdateMarketMap", + FullMethod: "/slinky.marketmap.v1.Msg/CreateMarkets", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateMarketMap(ctx, req.(*MsgUpdateMarketMap)) + return srv.(MsgServer).CreateMarkets(ctx, req.(*MsgCreateMarkets)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateMarkets) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateMarkets(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/slinky.marketmap.v1.Msg/UpdateMarkets", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateMarkets(ctx, req.(*MsgUpdateMarkets)) } return interceptor(ctx, in, info, handler) } @@ -436,24 +618,50 @@ func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interfac return interceptor(ctx, in, info, handler) } +func _Msg_RemoveMarketAuthorities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveMarketAuthorities) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).RemoveMarketAuthorities(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/slinky.marketmap.v1.Msg/RemoveMarketAuthorities", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).RemoveMarketAuthorities(ctx, req.(*MsgRemoveMarketAuthorities)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "slinky.marketmap.v1.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "UpdateMarketMap", - Handler: _Msg_UpdateMarketMap_Handler, + MethodName: "CreateMarkets", + Handler: _Msg_CreateMarkets_Handler, + }, + { + MethodName: "UpdateMarkets", + Handler: _Msg_UpdateMarkets_Handler, }, { MethodName: "Params", Handler: _Msg_Params_Handler, }, + { + MethodName: "RemoveMarketAuthorities", + Handler: _Msg_RemoveMarketAuthorities_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "slinky/marketmap/v1/tx.proto", } -func (m *CreateMarket) Marshal() (dAtA []byte, err error) { +func (m *MsgCreateMarkets) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -463,50 +671,64 @@ func (m *CreateMarket) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *CreateMarket) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgCreateMarkets) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *CreateMarket) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgCreateMarkets) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size, err := m.Paths.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err + if len(m.CreateMarkets) > 0 { + for iNdEx := len(m.CreateMarkets) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CreateMarkets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x1a - { - size, err := m.Providers.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa } - i-- - dAtA[i] = 0x12 - { - size, err := m.Ticker.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + return len(dAtA) - i, nil +} + +func (m *MsgCreateMarketsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err } - i-- - dAtA[i] = 0xa + return dAtA[:n], nil +} + +func (m *MsgCreateMarketsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l return len(dAtA) - i, nil } -func (m *MsgUpdateMarketMap) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateMarkets) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -516,20 +738,20 @@ func (m *MsgUpdateMarketMap) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateMarketMap) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateMarkets) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateMarketMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateMarkets) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.CreateMarkets) > 0 { - for iNdEx := len(m.CreateMarkets) - 1; iNdEx >= 0; iNdEx-- { + if len(m.UpdateMarkets) > 0 { + for iNdEx := len(m.UpdateMarkets) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.CreateMarkets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.UpdateMarkets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -540,17 +762,17 @@ func (m *MsgUpdateMarketMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } } - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *MsgUpdateMarketMapResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateMarketsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -560,12 +782,12 @@ func (m *MsgUpdateMarketMapResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgUpdateMarketMapResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateMarketsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgUpdateMarketMapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -636,6 +858,68 @@ func (m *MsgParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *MsgRemoveMarketAuthorities) 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 *MsgRemoveMarketAuthorities) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveMarketAuthorities) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Admin) > 0 { + i -= len(m.Admin) + copy(dAtA[i:], m.Admin) + i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) + i-- + dAtA[i] = 0x12 + } + if len(m.RemoveAddresses) > 0 { + for iNdEx := len(m.RemoveAddresses) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.RemoveAddresses[iNdEx]) + copy(dAtA[i:], m.RemoveAddresses[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.RemoveAddresses[iNdEx]))) + i-- + dAtA[i] = 0xa + } + } + return len(dAtA) - i, nil +} + +func (m *MsgRemoveMarketAuthoritiesResponse) 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 *MsgRemoveMarketAuthoritiesResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgRemoveMarketAuthoritiesResponse) 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 @@ -647,41 +931,78 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *CreateMarket) Size() (n int) { +func (m *MsgCreateMarkets) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.CreateMarkets) > 0 { + for _, e := range m.CreateMarkets { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreateMarketsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateMarkets) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if len(m.UpdateMarkets) > 0 { + for _, e := range m.UpdateMarkets { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgUpdateMarketsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Ticker.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Providers.Size() - n += 1 + l + sovTx(uint64(l)) - l = m.Paths.Size() - n += 1 + l + sovTx(uint64(l)) return n } -func (m *MsgUpdateMarketMap) Size() (n int) { +func (m *MsgParams) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Signer) + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if len(m.CreateMarkets) > 0 { - for _, e := range m.CreateMarkets { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } return n } -func (m *MsgUpdateMarketMapResponse) Size() (n int) { +func (m *MsgParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -690,22 +1011,26 @@ func (m *MsgUpdateMarketMapResponse) Size() (n int) { return n } -func (m *MsgParams) Size() (n int) { +func (m *MsgRemoveMarketAuthorities) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Authority) + if len(m.RemoveAddresses) > 0 { + for _, s := range m.RemoveAddresses { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } + } + l = len(m.Admin) if l > 0 { n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgParamsResponse) Size() (n int) { +func (m *MsgRemoveMarketAuthoritiesResponse) Size() (n int) { if m == nil { return 0 } @@ -720,7 +1045,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *CreateMarket) Unmarshal(dAtA []byte) error { +func (m *MsgCreateMarkets) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -743,17 +1068,17 @@ func (m *CreateMarket) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: CreateMarket: wiretype end group for non-group") + return fmt.Errorf("proto: MsgCreateMarkets: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: CreateMarket: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgCreateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -763,28 +1088,27 @@ func (m *CreateMarket) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Ticker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Providers", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field CreateMarkets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -811,43 +1135,61 @@ func (m *CreateMarket) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Providers.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.CreateMarkets = append(m.CreateMarkets, Market{}) + if err := m.CreateMarkets[len(m.CreateMarkets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Paths", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err } - if msglen < 0 { + if (skippy < 0) || (iNdEx+skippy) < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } - if postIndex > l { + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgCreateMarketsResponse) 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 } - if err := m.Paths.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break } - iNdEx = postIndex + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgCreateMarketsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateMarketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { default: iNdEx = preIndex skippy, err := skipTx(dAtA[iNdEx:]) @@ -869,7 +1211,7 @@ func (m *CreateMarket) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateMarketMap) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateMarkets) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -892,15 +1234,15 @@ func (m *MsgUpdateMarketMap) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateMarketMap: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateMarkets: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateMarketMap: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -928,11 +1270,11 @@ func (m *MsgUpdateMarketMap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreateMarkets", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field UpdateMarkets", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -959,8 +1301,8 @@ func (m *MsgUpdateMarketMap) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.CreateMarkets = append(m.CreateMarkets, CreateMarket{}) - if err := m.CreateMarkets[len(m.CreateMarkets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.UpdateMarkets = append(m.UpdateMarkets, Market{}) + if err := m.UpdateMarkets[len(m.UpdateMarkets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -985,7 +1327,7 @@ func (m *MsgUpdateMarketMap) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgUpdateMarketMapResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateMarketsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1008,10 +1350,10 @@ func (m *MsgUpdateMarketMapResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgUpdateMarketMapResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateMarketsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateMarketMapResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateMarketsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1200,6 +1542,170 @@ func (m *MsgParamsResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgRemoveMarketAuthorities) 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: MsgRemoveMarketAuthorities: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveMarketAuthorities: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RemoveAddresses", 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.RemoveAddresses = append(m.RemoveAddresses, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Admin", 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.Admin = 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 *MsgRemoveMarketAuthoritiesResponse) 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: MsgRemoveMarketAuthoritiesResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgRemoveMarketAuthoritiesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/marketmap/types/utils.go b/x/marketmap/types/utils.go new file mode 100644 index 000000000..519ddfd16 --- /dev/null +++ b/x/marketmap/types/utils.go @@ -0,0 +1,30 @@ +package types + +import ( + "encoding/json" + "fmt" + "os" +) + +// ReadMarketMapFromFile reads a market map configuration from a file at the given path. +func ReadMarketMapFromFile(path string) (MarketMap, error) { + // Initialize the struct to hold the configuration + var config MarketMap + + // Read the entire file at the given path + data, err := os.ReadFile(path) + if err != nil { + return config, fmt.Errorf("error reading config file: %w", err) + } + + // Unmarshal the JSON data into the config struct + if err := json.Unmarshal(data, &config); err != nil { + return config, fmt.Errorf("error unmarshalling config JSON: %w", err) + } + + if err := config.ValidateBasic(); err != nil { + return config, fmt.Errorf("error validating config: %w", err) + } + + return config, nil +} diff --git a/x/mm2/client/cli/query.go b/x/mm2/client/cli/query.go deleted file mode 100644 index 3918baf43..000000000 --- a/x/mm2/client/cli/query.go +++ /dev/null @@ -1,138 +0,0 @@ -package cli - -import ( - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/mm2/types" -) - -// GetQueryCmd returns the parent command for all x/marketmap cli query commands. -func GetQueryCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: types.ModuleName, - Short: "Querying commands for the marketmap module", - DisableFlagParsing: true, - SuggestionsMinimumDistance: 2, - RunE: client.ValidateCmd, - } - - cmd.AddCommand( - CmdQueryParams(), - CmdQueryMarketMap(), - CmdQueryLastUpdated(), - CmdQueryMarket(), - ) - - return cmd -} - -// CmdQueryParams returns the command for querying the module's parameters. -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "Query the current marketmap module parameters", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Params(clientCtx.CmdContext, &types.ParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(&res.Params) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -func CmdQueryMarketMap() *cobra.Command { - cmd := &cobra.Command{ - Use: "market-map", - Short: "Query the current market map", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.MarketMap(clientCtx.CmdContext, &types.MarketMapRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -func CmdQueryMarket() *cobra.Command { - cmd := &cobra.Command{ - Use: "market", - Short: "Query the a market using the given currency pair", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - cp, err := slinkytypes.CurrencyPairFromString(args[0]) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.Market(clientCtx.CmdContext, &types.MarketRequest{ - CurrencyPair: cp, - }) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -func CmdQueryLastUpdated() *cobra.Command { - cmd := &cobra.Command{ - Use: "last-updated", - Short: "Query the last height the market map was updated at", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, _ []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - - queryClient := types.NewQueryClient(clientCtx) - res, err := queryClient.LastUpdated(clientCtx.CmdContext, &types.LastUpdatedRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} diff --git a/x/mm2/keeper/genesis.go b/x/mm2/keeper/genesis.go deleted file mode 100644 index 210de0cb1..000000000 --- a/x/mm2/keeper/genesis.go +++ /dev/null @@ -1,62 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/mm2/types" -) - -// InitGenesis initializes the genesis state. Panics if there is an error. -// Any modules that integrate with x/marketmap must set their InitGenesis to occur before the x/marketmap -// module's InitGenesis. This is so that logic any consuming modules may want to implement in AfterMarketGenesis -// will be run properly. -func (k *Keeper) InitGenesis(ctx sdk.Context, gs types.GenesisState) { - // validate the genesis - if err := gs.ValidateBasic(); err != nil { - panic(err) - } - - for _, market := range gs.MarketMap.Markets { - if err := k.CreateMarket(ctx, market); err != nil { - panic(err) - } - } - - if err := k.SetLastUpdated(ctx, gs.LastUpdated); err != nil { - panic(err) - } - - if err := k.SetParams(ctx, gs.Params); err != nil { - panic(err) - } - - if err := k.hooks.AfterMarketGenesis(ctx, gs.MarketMap.Markets); err != nil { - panic(err) - } -} - -// ExportGenesis retrieves the genesis from state. -func (k *Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { - markets, err := k.GetAllMarkets(ctx) - if err != nil { - panic(err) - } - - lastUpdated, err := k.GetLastUpdated(ctx) - if err != nil { - panic(err) - } - - params, err := k.GetParams(ctx) - if err != nil { - panic(err) - } - - return &types.GenesisState{ - MarketMap: types.MarketMap{ - Markets: markets, - }, - LastUpdated: lastUpdated, - Params: params, - } -} diff --git a/x/mm2/keeper/genesis_test.go b/x/mm2/keeper/genesis_test.go deleted file mode 100644 index eb4a55a97..000000000 --- a/x/mm2/keeper/genesis_test.go +++ /dev/null @@ -1,117 +0,0 @@ -package keeper_test - -import ( - sdkmath "cosmossdk.io/math" - - "github.com/skip-mev/slinky/x/mm2/types" - oracletypes "github.com/skip-mev/slinky/x/oracle/types" -) - -func (s *KeeperTestSuite) TestInitGenesisInvalidGenesis() { - s.Run("test that init genesis with invalid genesis params - fails", func() { - // create a fake genesis state with invalid params - gs := types.GenesisState{ - MarketMap: types.DefaultGenesisState().MarketMap, - Params: types.Params{ - MarketAuthorities: []string{"invalid"}, - }, - } - - // assert that InitGenesis panics - s.Require().Panics(func() { - s.keeper.InitGenesis(s.ctx, gs) - }) - }) - - s.Run("test that init genesis with invalid duplicate runs - fails", func() { - // create a valid genesis - gs := types.DefaultGenesisState() - - gs.MarketMap = types.MarketMap{ - Markets: map[string]types.Market{ - ethusdt.Ticker.String(): ethusdt, - btcusdt.Ticker.String(): btcusdt, - usdcusd.Ticker.String(): usdcusd, - }, - } - - // assert that InitGenesis panics - s.Require().Panics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - s.keeper.InitGenesis(s.ctx, *gs) - }) - }) -} - -func (s *KeeperTestSuite) TestInitExportGenesisValid() { - s.Run("init valid default genesis and export", func() { - gs := types.DefaultGenesisState() - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - var gotState *types.GenesisState - s.Require().NotPanics(func() { - gotState = s.keeper.ExportGenesis(s.ctx) - }) - - s.Require().Equal(gs, gotState) - }) - - s.Run("init valid genesis with fields", func() { - // first register x/oracle genesis - ogs := oracletypes.DefaultGenesisState() - ogs.NextId = 4 - ogs.CurrencyPairGenesis = []oracletypes.CurrencyPairGenesis{ - { - CurrencyPair: ethusdt.Ticker.CurrencyPair, - CurrencyPairPrice: &oracletypes.QuotePrice{Price: sdkmath.NewInt(19)}, - Nonce: 0, - Id: 0, - }, - { - CurrencyPair: btcusdt.Ticker.CurrencyPair, - CurrencyPairPrice: &oracletypes.QuotePrice{Price: sdkmath.NewInt(19)}, - Nonce: 0, - Id: 1, - }, - { - CurrencyPair: usdcusd.Ticker.CurrencyPair, - CurrencyPairPrice: nil, - Nonce: 0, - Id: 2, - }, - { - CurrencyPair: usdtusd.Ticker.CurrencyPair, - CurrencyPairPrice: nil, - Nonce: 0, - Id: 3, - }, - } - - s.Require().NotPanics(func() { - s.oracleKeeper.InitGenesis(s.ctx, *ogs) - }) - - gs := types.DefaultGenesisState() - gs.MarketMap = types.MarketMap{ - Markets: marketsMap, - } - - s.Require().NotPanics(func() { - s.keeper.InitGenesis(s.ctx, *gs) - }) - - gotMarkets, err := s.keeper.GetAllMarkets(s.ctx) - s.Require().NoError(err) - s.Require().Equal(gs.MarketMap.Markets, gotMarkets) - - var gotState *types.GenesisState - s.Require().NotPanics(func() { - gotState = s.keeper.ExportGenesis(s.ctx) - }) - - s.Require().Equal(gs, gotState) - }) -} diff --git a/x/mm2/keeper/hooks.go b/x/mm2/keeper/hooks.go deleted file mode 100644 index 9c42baf24..000000000 --- a/x/mm2/keeper/hooks.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper - -import ( - "github.com/skip-mev/slinky/x/mm2/types" -) - -// Hooks gets the hooks for x/marketmap keeper. -func (k *Keeper) Hooks() types.MarketMapHooks { - if k.hooks == nil { - // return a no-op implementation if no hooks are set - return types.MultiMarketMapHooks{} - } - - return k.hooks -} - -// SetHooks sets the x/marketmap hooks. In contrast to other receivers, this method must take a pointer due to nature -// of the hooks interface and SDK start up sequence. -func (k *Keeper) SetHooks(mmh types.MarketMapHooks) { - if k.hooks != nil { - panic("cannot set marketmap hooks twice") - } - - k.hooks = mmh -} diff --git a/x/mm2/keeper/keeper.go b/x/mm2/keeper/keeper.go deleted file mode 100644 index d743235f4..000000000 --- a/x/mm2/keeper/keeper.go +++ /dev/null @@ -1,161 +0,0 @@ -package keeper - -import ( - "fmt" - - "cosmossdk.io/collections" - "cosmossdk.io/core/store" - "github.com/cosmos/cosmos-sdk/codec" - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/mm2/types" -) - -// Keeper is the module's keeper implementation. -type Keeper struct { - cdc codec.BinaryCodec - - // module authority - authority sdk.AccAddress - - // registered hooks - hooks types.MarketMapHooks - - // markets is keyed by CurrencyPair string (BASE/QUOTE) and contains - // the list of all Markets. - markets collections.Map[types.TickerString, types.Market] - - // lastUpdated is the last block height the marketmap was updated. - lastUpdated collections.Item[uint64] - - // params is the module's parameters. - params collections.Item[types.Params] -} - -// NewKeeper initializes the keeper and its backing stores. -func NewKeeper(ss store.KVStoreService, cdc codec.BinaryCodec, authority sdk.AccAddress) *Keeper { - sb := collections.NewSchemaBuilder(ss) - - // Create the collections item that will track the module parameters. - params := collections.NewItem[types.Params]( - sb, - types.ParamsPrefix, - "params", - codec.CollValue[types.Params](cdc), - ) - - return &Keeper{ - cdc: cdc, - authority: authority, - markets: collections.NewMap(sb, types.MarketsPrefix, "markets", types.TickersCodec, codec.CollValue[types.Market](cdc)), - lastUpdated: collections.NewItem[uint64](sb, types.LastUpdatedPrefix, "last_updated", types.LastUpdatedCodec), - params: params, - } -} - -// SetLastUpdated sets the lastUpdated field to the current block height. -func (k *Keeper) SetLastUpdated(ctx sdk.Context, height uint64) error { - return k.lastUpdated.Set(ctx, height) -} - -// GetLastUpdated gets the last block-height the market map was updated. -func (k *Keeper) GetLastUpdated(ctx sdk.Context) (uint64, error) { - return k.lastUpdated.Get(ctx) -} - -// GetMarket returns a market from the store by its currency pair string ID. -func (k *Keeper) GetMarket(ctx sdk.Context, tickerStr string) (types.Market, error) { - return k.markets.Get(ctx, types.TickerString(tickerStr)) -} - -// GetAllMarkets returns the set of Market objects currently stored in state -// as a map[TickerString] -> Markets. -func (k *Keeper) GetAllMarkets(ctx sdk.Context) (map[string]types.Market, error) { - iter, err := k.markets.Iterate(ctx, nil) - if err != nil { - return nil, err - } - keyValues, err := iter.KeyValues() - if err != nil { - return nil, err - } - - m := make(map[string]types.Market, len(keyValues)) - for _, keyValue := range keyValues { - m[string(keyValue.Key)] = keyValue.Value - } - - return m, nil -} - -// CreateMarket initializes a new Market. -// The Ticker.String corresponds to a market, and must be unique. -func (k *Keeper) CreateMarket(ctx sdk.Context, market types.Market) error { - // Check if Ticker already exists for the provider - alreadyExists, err := k.markets.Has(ctx, types.TickerString(market.Ticker.String())) - if err != nil { - return err - } - if alreadyExists { - return types.NewMarketAlreadyExistsError(types.TickerString(market.Ticker.String())) - } - // Create the config - return k.markets.Set(ctx, types.TickerString(market.Ticker.String()), market) -} - -// UpdateMarket updates a Market. -// The Ticker.String corresponds to a market, and exist unique. -func (k *Keeper) UpdateMarket(ctx sdk.Context, market types.Market) error { - // Check if Ticker already exists for the provider - alreadyExists, err := k.markets.Has(ctx, types.TickerString(market.Ticker.String())) - if err != nil { - return err - } - if !alreadyExists { - return types.NewMarketDoesNotExistsError(types.TickerString(market.Ticker.String())) - } - // Create the config - return k.markets.Set(ctx, types.TickerString(market.Ticker.String()), market) -} - -// SetParams sets the x/marketmap module's parameters. -func (k *Keeper) SetParams(ctx sdk.Context, params types.Params) error { - return k.params.Set(ctx, params) -} - -// GetParams returns the x/marketmap module's parameters. -func (k *Keeper) GetParams(ctx sdk.Context) (types.Params, error) { - return k.params.Get(ctx) -} - -// ValidateState is called after keeper modifications have been made to the market map to verify that -// the aggregate of all updates has led to a valid state. -func (k *Keeper) ValidateState(ctx sdk.Context, updates []types.Market) error { - for _, market := range updates { - if err := k.IsMarketValid(ctx, market); err != nil { - return err - } - } - - return nil -} - -// IsMarketValid checks if a market is valid by statefully checking if each of the currency pairs -// specified by its provider configs are valid and in state. -func (k *Keeper) IsMarketValid(ctx sdk.Context, market types.Market) error { - // check that all markets already exist in the keeper store: - for _, providerConfig := range market.ProviderConfigs { - if providerConfig.NormalizeByPair != nil { - has, err := k.markets.Has(ctx, types.TickerString(providerConfig.NormalizeByPair.String())) - if err != nil { - return err - } - - if !has { - return fmt.Errorf("currency pair %s in provider config does not exist", providerConfig.NormalizeByPair.String()) - } - } - } - - return nil -} diff --git a/x/mm2/keeper/keeper_test.go b/x/mm2/keeper/keeper_test.go deleted file mode 100644 index 4750719be..000000000 --- a/x/mm2/keeper/keeper_test.go +++ /dev/null @@ -1,274 +0,0 @@ -package keeper_test - -import ( - "testing" - - "github.com/skip-mev/chaintestutil/sample" - - oraclekeeper "github.com/skip-mev/slinky/x/oracle/keeper" - oracletypes "github.com/skip-mev/slinky/x/oracle/types" - - storetypes "cosmossdk.io/store/types" - "github.com/cosmos/cosmos-sdk/runtime" - "github.com/cosmos/cosmos-sdk/testutil" - sdk "github.com/cosmos/cosmos-sdk/types" - moduletestutil "github.com/cosmos/cosmos-sdk/types/module/testutil" - "github.com/stretchr/testify/suite" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/mm2/keeper" - "github.com/skip-mev/slinky/x/mm2/types" -) - -var r = sample.Rand() - -type KeeperTestSuite struct { - suite.Suite - - ctx sdk.Context - - // Keeper variables - authority sdk.AccAddress - marketAuthorities []string - admin string - - keeper *keeper.Keeper - oracleKeeper oraclekeeper.Keeper -} - -func (s *KeeperTestSuite) initKeeper() *keeper.Keeper { - mmKey := storetypes.NewKVStoreKey(types.StoreKey) - oracleKey := storetypes.NewKVStoreKey(oracletypes.StoreKey) - mmSS := runtime.NewKVStoreService(mmKey) - oracleSS := runtime.NewKVStoreService(oracleKey) - encCfg := moduletestutil.MakeTestEncodingConfig() - - keys := map[string]*storetypes.KVStoreKey{ - types.StoreKey: mmKey, - oracletypes.StoreKey: oracleKey, - } - - transientKeys := map[string]*storetypes.TransientStoreKey{ - types.StoreKey: storetypes.NewTransientStoreKey("transient_mm"), - oracletypes.StoreKey: storetypes.NewTransientStoreKey("transient_oracle"), - } - - s.authority = sdk.AccAddress("authority") - s.ctx = testutil.DefaultContextWithKeys(keys, transientKeys, nil).WithBlockHeight(10) - - k := keeper.NewKeeper(mmSS, encCfg.Codec, s.authority) - s.Require().NoError(k.SetLastUpdated(s.ctx, uint64(s.ctx.BlockHeight()))) - - s.admin = sample.Address(r) - s.marketAuthorities = []string{sample.Address(r), sample.Address(r), sample.Address(r)} - - params := types.Params{ - MarketAuthorities: s.marketAuthorities, - Admin: s.admin, - } - s.Require().NoError(k.SetParams(s.ctx, params)) - - s.oracleKeeper = oraclekeeper.NewKeeper(oracleSS, encCfg.Codec, k, s.authority) - hooks := types.MultiMarketMapHooks{ - s.oracleKeeper.Hooks(), - } - k.SetHooks(hooks) - - s.Require().NotPanics(func() { - s.oracleKeeper.InitGenesis(s.ctx, *oracletypes.DefaultGenesisState()) - }) - - return k -} - -func (s *KeeperTestSuite) SetupTest() { - s.keeper = s.initKeeper() -} - -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -var ( - btcusdt = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-usdt", - }, - }, - } - - usdtusd = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "usdt-usd", - }, - }, - } - - usdcusd = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDC", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "usdc-usd", - }, - }, - } - - ethusdt = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "eth-usdt", - }, - }, - } - - markets = []types.Market{ - btcusdt, - usdcusd, - usdtusd, - ethusdt, - } - - marketsMap = map[string]types.Market{ - btcusdt.Ticker.String(): btcusdt, - usdcusd.Ticker.String(): usdcusd, - usdtusd.Ticker.String(): usdtusd, - ethusdt.Ticker.String(): ethusdt, - } -) - -func (s *KeeperTestSuite) TestGets() { - s.Run("get empty market map", func() { - got, err := s.keeper.GetAllMarkets(s.ctx) - s.Require().NoError(err) - s.Require().Equal(map[string]types.Market{}, got) - }) - - s.Run("setup initial markets", func() { - for _, market := range markets { - s.Require().NoError(s.keeper.CreateMarket(s.ctx, market)) - } - - s.Run("unable to set markets again", func() { - for _, market := range markets { - s.Require().ErrorIs(s.keeper.CreateMarket(s.ctx, market), types.NewMarketAlreadyExistsError(types.TickerString(market.Ticker.String()))) - } - }) - - s.Require().NoError(s.keeper.ValidateState(s.ctx, markets)) - }) - - s.Run("get all tickers", func() { - got, err := s.keeper.GetAllMarkets(s.ctx) - s.Require().NoError(err) - - s.Require().Equal(len(markets), len(got)) - s.Require().Equal(marketsMap, got) - }) -} - -func (s *KeeperTestSuite) TestSetParams() { - params := types.DefaultParams() - - s.Run("can set and get params", func() { - err := s.keeper.SetParams(s.ctx, params) - s.Require().NoError(err) - - params2, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(params, params2) - }) -} - -func (s *KeeperTestSuite) TestInvalidCreate() { - // invalid market with a normalize pair not in state - invalidMarket := types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-usdt", - NormalizeByPair: &slinkytypes.CurrencyPair{Base: "invalid", Quote: "pair"}, - }, - }, - } - - s.Require().NoError(s.keeper.CreateMarket(s.ctx, invalidMarket)) - s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) -} - -func (s *KeeperTestSuite) TestInvalidUpdate() { - // create a valid market - s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) - - // invalid market with a normalize pair not in state - invalidMarket := btcusdt - invalidMarket.ProviderConfigs = append(invalidMarket.ProviderConfigs, types.ProviderConfig{ - Name: "huobi", - OffChainTicker: "btc-usdt", - NormalizeByPair: &slinkytypes.CurrencyPair{Base: "invalid", Quote: "pair"}, - }) - - s.Require().NoError(s.keeper.UpdateMarket(s.ctx, invalidMarket)) - s.Require().Error(s.keeper.ValidateState(s.ctx, []types.Market{invalidMarket})) -} - -func (s *KeeperTestSuite) TestValidUpdate() { - // create a valid markets - s.Require().NoError(s.keeper.CreateMarket(s.ctx, btcusdt)) - s.Require().NoError(s.keeper.CreateMarket(s.ctx, ethusdt)) - - // valid market with a normalize pair that is in state - validMarket := btcusdt - validMarket.ProviderConfigs = append(validMarket.ProviderConfigs, types.ProviderConfig{ - Name: "huobi", - OffChainTicker: "btc-usdt", - NormalizeByPair: ðusdt.Ticker.CurrencyPair, - }) - - s.Require().NoError(s.keeper.UpdateMarket(s.ctx, validMarket)) - s.Require().NoError(s.keeper.ValidateState(s.ctx, []types.Market{validMarket})) -} diff --git a/x/mm2/keeper/msg_server.go b/x/mm2/keeper/msg_server.go deleted file mode 100644 index e128cf35d..000000000 --- a/x/mm2/keeper/msg_server.go +++ /dev/null @@ -1,196 +0,0 @@ -package keeper - -import ( - "context" - "fmt" - "slices" - "strconv" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/skip-mev/slinky/x/mm2/types" -) - -// msgServer is the default implementation of the x/marketmap MsgService. -type msgServer struct { - k *Keeper -} - -// NewMsgServer returns the default implementation of the x/marketmap message service. -func NewMsgServer(k *Keeper) types.MsgServer { - return &msgServer{k} -} - -var _ types.MsgServer = (*msgServer)(nil) - -// CreateMarkets updates the marketmap by creating markets from the given message. All updates are made to the market -// map and then the resulting final state is checked to verify that the end state is valid. -func (ms msgServer) CreateMarkets(goCtx context.Context, msg *types.MsgCreateMarkets) (*types.MsgCreateMarketsResponse, error) { - if msg == nil { - return nil, fmt.Errorf("unable to process nil msg") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - params, err := ms.k.GetParams(ctx) - if err != nil { - return nil, fmt.Errorf("unable to get marketmap params: %w", err) - } - - found := checkMarketAuthority(msg.Authority, params) - if !found { - return nil, fmt.Errorf("request signer %s does not match module market authorities", msg.Authority) - } - - // create markets - for _, market := range msg.CreateMarkets { - err = ms.k.CreateMarket(ctx, market) - if err != nil { - return nil, err - } - - err = ms.k.hooks.AfterMarketCreated(ctx, market) - if err != nil { - return nil, fmt.Errorf("unable to run create market hook: %w", err) - } - - event := sdk.NewEvent( - types.EventTypeCreateMarket, - sdk.NewAttribute(types.AttributeKeyCurrencyPair, market.Ticker.String()), - sdk.NewAttribute(types.AttributeKeyDecimals, strconv.FormatUint(market.Ticker.Decimals, 10)), - sdk.NewAttribute(types.AttributeKeyMinProviderCount, strconv.FormatUint(market.Ticker.MinProviderCount, 10)), - sdk.NewAttribute(types.AttributeKeyMetadata, market.Ticker.Metadata_JSON), - ) - ctx.EventManager().EmitEvent(event) - } - - // validate that the new state of the marketmap is valid - err = ms.k.ValidateState(ctx, msg.CreateMarkets) - if err != nil { - return nil, fmt.Errorf("invalid state resulting from update: %w", err) - } - - return &types.MsgCreateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) -} - -// UpdateMarkets updates the marketmap by updating markets from the given message. All updates are made to the market -// map and then the resulting final state is checked to verify that the end state is valid. -func (ms msgServer) UpdateMarkets(goCtx context.Context, msg *types.MsgUpdateMarkets) (*types.MsgUpdateMarketsResponse, error) { - if msg == nil { - return nil, fmt.Errorf("unable to process nil msg") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - params, err := ms.k.GetParams(ctx) - if err != nil { - return nil, fmt.Errorf("unable to get marketmap params: %w", err) - } - - found := checkMarketAuthority(msg.Authority, params) - if !found { - return nil, fmt.Errorf("request signer %s does not match module market authorities", msg.Authority) - } - - for _, market := range msg.UpdateMarkets { - err = ms.k.UpdateMarket(ctx, market) - if err != nil { - return nil, fmt.Errorf("unable to update market: %w", err) - } - - err = ms.k.hooks.AfterMarketUpdated(ctx, market) - if err != nil { - return nil, fmt.Errorf("unable to run update market hook: %w", err) - } - - event := sdk.NewEvent( - types.EventTypeUpdateMarket, - sdk.NewAttribute(types.AttributeKeyCurrencyPair, market.Ticker.String()), - sdk.NewAttribute(types.AttributeKeyDecimals, strconv.FormatUint(market.Ticker.Decimals, 10)), - sdk.NewAttribute(types.AttributeKeyMinProviderCount, strconv.FormatUint(market.Ticker.MinProviderCount, 10)), - sdk.NewAttribute(types.AttributeKeyMetadata, market.Ticker.Metadata_JSON), - ) - ctx.EventManager().EmitEvent(event) - - } - - // validate that the new state of the marketmap is valid - err = ms.k.ValidateState(ctx, msg.UpdateMarkets) - if err != nil { - return nil, fmt.Errorf("invalid state resulting from update: %w", err) - } - - return &types.MsgUpdateMarketsResponse{}, ms.k.SetLastUpdated(ctx, uint64(ctx.BlockHeight())) -} - -// Params updates the x/marketmap module's Params. -func (ms msgServer) Params(goCtx context.Context, msg *types.MsgParams) (*types.MsgParamsResponse, error) { - if msg == nil { - return nil, fmt.Errorf("unable to process nil msg") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - if msg.Authority != ms.k.authority.String() { - return nil, fmt.Errorf("request authority %s does not match module keeper authority %s", msg.Authority, ms.k.authority.String()) - } - - if err := ms.k.SetParams(ctx, msg.Params); err != nil { - return nil, err - } - - return &types.MsgParamsResponse{}, nil -} - -func (ms msgServer) RemoveMarketAuthorities(goCtx context.Context, msg *types.MsgRemoveMarketAuthorities) (*types.MsgRemoveMarketAuthoritiesResponse, error) { - if msg == nil { - return nil, fmt.Errorf("unable to process nil msg") - } - - ctx := sdk.UnwrapSDKContext(goCtx) - - params, err := ms.k.GetParams(ctx) - if err != nil { - return nil, err - } - - if msg.Admin != params.Admin { - return nil, fmt.Errorf("request admin %s does not match module admin %s", msg.Admin, params.Admin) - } - - if len(msg.RemoveAddresses) > len(params.MarketAuthorities) { - return nil, fmt.Errorf("remove addresses must be a subset of the current market authorities") - } - - removeAddresses := make(map[string]struct{}, len(msg.RemoveAddresses)) - for _, remove := range msg.RemoveAddresses { - removeAddresses[remove] = struct{}{} - } - - for i, address := range params.MarketAuthorities { - if _, found := removeAddresses[address]; found { - params.MarketAuthorities = slices.Delete(params.MarketAuthorities, i, i+1) - } - } - - if err := ms.k.SetParams(ctx, params); err != nil { - return nil, err - } - - return &types.MsgRemoveMarketAuthoritiesResponse{}, nil -} - -// checkMarketAuthority checks if the given authority is the x/marketmap's list of MarketAuthorities. -func checkMarketAuthority(authority string, params types.Params) bool { - if len(params.MarketAuthorities) == 0 { - return false - } - - for _, auth := range params.MarketAuthorities { - if authority == auth { - return true - } - } - - return false -} diff --git a/x/mm2/keeper/msg_server_test.go b/x/mm2/keeper/msg_server_test.go deleted file mode 100644 index 088a498c2..000000000 --- a/x/mm2/keeper/msg_server_test.go +++ /dev/null @@ -1,328 +0,0 @@ -package keeper_test - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/skip-mev/chaintestutil/sample" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/mm2/keeper" - "github.com/skip-mev/slinky/x/mm2/types" -) - -func (s *KeeperTestSuite) TestMsgServerCreateMarkets() { - msgServer := keeper.NewMsgServer(s.keeper) - - // create initial markets - msg := &types.MsgCreateMarkets{ - Authority: s.marketAuthorities[1], - CreateMarkets: []types.Market{ - btcusdt, - usdtusd, - }, - } - resp, err := msgServer.CreateMarkets(s.ctx, msg) - s.Require().NoError(err) - s.Require().NotNil(resp) - - // query the market map - mm, err := s.keeper.GetAllMarkets(s.ctx) - s.Require().NoError(err) - s.Require().Equal(types.MarketMap{Markets: mm}, types.MarketMap{ - Markets: map[string]types.Market{ - btcusdt.Ticker.String(): btcusdt, - usdtusd.Ticker.String(): usdtusd, - }, - }) - - // query the oracle module to see if they were created via hooks - cps := s.oracleKeeper.GetAllCurrencyPairs(s.ctx) - s.Require().Equal([]slinkytypes.CurrencyPair{btcusdt.Ticker.CurrencyPair, usdtusd.Ticker.CurrencyPair}, cps) - - s.Run("unable to process for invalid authority", func() { - msg = &types.MsgCreateMarkets{ - Authority: "invalid", - } - resp, err = msgServer.CreateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to process for invalid authority (valid bech32)", func() { - msg = &types.MsgCreateMarkets{ - Authority: sdk.AccAddress("invalid").String(), - } - resp, err = msgServer.CreateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - // set a market in the map - s.Run("unable to process nil request", func() { - resp, err = msgServer.CreateMarkets(s.ctx, nil) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to create market that already exists", func() { - msg = &types.MsgCreateMarkets{ - Authority: s.authority.String(), - CreateMarkets: []types.Market{ - btcusdt, - }, - } - resp, err = msgServer.CreateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to create market with normalize by that is not on chain tickers", func() { - msg = &types.MsgCreateMarkets{ - Authority: s.authority.String(), - CreateMarkets: []types.Market{ - { - Ticker: ethusdt.Ticker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "eth-usdt", - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "INVALID", - Quote: "PAIR", - }, - }, - }, - }, - }, - } - resp, err = msgServer.CreateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) -} - -func (s *KeeperTestSuite) TestMsgServerUpdateMarkets() { - msgServer := keeper.NewMsgServer(s.keeper) - - // create initial markets - createMsg := &types.MsgCreateMarkets{ - Authority: s.marketAuthorities[0], - CreateMarkets: []types.Market{ - btcusdt, - usdtusd, - }, - } - createResp, err := msgServer.CreateMarkets(s.ctx, createMsg) - s.Require().NoError(err) - s.Require().NotNil(createResp) - - // query the market map - mm, err := s.keeper.GetAllMarkets(s.ctx) - s.Require().NoError(err) - s.Require().Equal(types.MarketMap{Markets: mm}, types.MarketMap{ - Markets: map[string]types.Market{ - btcusdt.Ticker.String(): btcusdt, - usdtusd.Ticker.String(): usdtusd, - }, - }) - - // TODO: test hooks - - s.Run("unable to process for invalid authority", func() { - msg := &types.MsgUpdateMarkets{ - Authority: "invalid", - } - resp, err := msgServer.UpdateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to process for invalid authority (valid bech32)", func() { - msg := &types.MsgUpdateMarkets{ - Authority: sdk.AccAddress("invalid").String(), - } - resp, err := msgServer.UpdateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - // set a market in the map - s.Run("unable to process nil request", func() { - resp, err := msgServer.UpdateMarkets(s.ctx, nil) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("able to update market that already exists", func() { - tickerUpdate := btcusdt - tickerUpdate.Ticker.Decimals = 1 - - msg := &types.MsgUpdateMarkets{ - Authority: s.marketAuthorities[2], - UpdateMarkets: []types.Market{ - tickerUpdate, - }, - } - resp, err := msgServer.UpdateMarkets(s.ctx, msg) - s.Require().NoError(err) - s.Require().NotNil(resp) - }) - - s.Run("unable to update when paths refers to non-existent ticker", func() { - tickerUpdate := btcusdt - tickerUpdate.Ticker.Decimals = 1 - tickerUpdate.ProviderConfigs = []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-usdc", - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "INVALID", - Quote: "PAIR", - }, - }, - } - - msg := &types.MsgUpdateMarkets{ - Authority: s.authority.String(), - UpdateMarkets: []types.Market{ - tickerUpdate, - }, - } - resp, err := msgServer.UpdateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to update market if it does not already exist", func() { - msg := &types.MsgUpdateMarkets{ - Authority: s.authority.String(), - UpdateMarkets: []types.Market{ - ethusdt, - }, - } - resp, err := msgServer.UpdateMarkets(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) -} - -func (s *KeeperTestSuite) TestMsgServerParams() { - msgServer := keeper.NewMsgServer(s.keeper) - - s.Run("unable to process nil request", func() { - resp, err := msgServer.Params(s.ctx, nil) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to process for invalid authority", func() { - msg := &types.MsgParams{ - Authority: "invalid", - } - resp, err := msgServer.Params(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to process for invalid authority (valid bech32)", func() { - msg := &types.MsgParams{ - Authority: sdk.AccAddress("invalid").String(), - } - resp, err := msgServer.Params(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("accepts a req with valid params", func() { - msg := &types.MsgParams{ - Authority: s.authority.String(), - Params: types.Params{ - MarketAuthorities: []string{types.DefaultMarketAuthority, sample.Address(r)}, - Admin: sample.Address(r), - }, - } - resp, err := msgServer.Params(s.ctx, msg) - s.Require().NoError(err) - s.Require().NotNil(resp) - - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(msg.Params, params) - }) -} - -func (s *KeeperTestSuite) TestMsgServerRemoveMarketAuthorities() { - msgServer := keeper.NewMsgServer(s.keeper) - - s.Run("unable to process nil request", func() { - resp, err := msgServer.RemoveMarketAuthorities(s.ctx, nil) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("unable to process for invalid authority", func() { - msg := &types.MsgRemoveMarketAuthorities{ - Admin: "invalid", - } - resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - }) - - s.Run("accepts a req that removes one authority", func() { - msg := &types.MsgRemoveMarketAuthorities{ - Admin: s.admin, - RemoveAddresses: []string{s.marketAuthorities[0]}, - } - resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) - s.Require().NoError(err) - s.Require().NotNil(resp) - - // check new authorities - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal(s.marketAuthorities[1:], params.MarketAuthorities) - - // reset - s.Require().NoError(s.keeper.SetParams(s.ctx, types.Params{ - MarketAuthorities: s.marketAuthorities, - Admin: s.admin, - })) - }) - - s.Run("accepts a req that removes multiple authorities", func() { - msg := &types.MsgRemoveMarketAuthorities{ - Admin: s.admin, - RemoveAddresses: []string{s.marketAuthorities[0], s.marketAuthorities[2]}, - } - resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) - s.Require().NoError(err) - s.Require().NotNil(resp) - - // check new authorities - params, err := s.keeper.GetParams(s.ctx) - s.Require().NoError(err) - s.Require().Equal([]string{s.marketAuthorities[1]}, params.MarketAuthorities) - - // reset - s.Require().NoError(s.keeper.SetParams(s.ctx, types.Params{ - MarketAuthorities: s.marketAuthorities, - Admin: s.admin, - })) - }) - - s.Run("unable to accept a req that removes more authorities than exist in state", func() { - msg := &types.MsgRemoveMarketAuthorities{ - Admin: s.admin, - RemoveAddresses: []string{sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r), sample.Address(r)}, - } - resp, err := msgServer.RemoveMarketAuthorities(s.ctx, msg) - s.Require().Error(err) - s.Require().Nil(resp) - - // reset - s.Require().NoError(s.keeper.SetParams(s.ctx, types.Params{ - MarketAuthorities: s.marketAuthorities, - Admin: s.admin, - })) - }) -} diff --git a/x/mm2/types/codec.go b/x/mm2/types/codec.go deleted file mode 100644 index 7e90eef60..000000000 --- a/x/mm2/types/codec.go +++ /dev/null @@ -1,30 +0,0 @@ -package types - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/legacy" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/msgservice" -) - -// RegisterLegacyAminoCodec registers the necessary x/marketmap interfaces (messages) on the -// cdc. These types are used for amino serialization. -func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - // register the msg-types - legacy.RegisterAminoMsg(cdc, &MsgCreateMarkets{}, "slinky/x/marketmap/MsgCreateMarkets") - legacy.RegisterAminoMsg(cdc, &MsgUpdateMarkets{}, "slinky/x/marketmap/MsgUpdateMarkets") - legacy.RegisterAminoMsg(cdc, &MsgParams{}, "slinky/x/marketmap/MsgParams") -} - -// RegisterInterfaces registers the x/marketmap messages + message service w/ the InterfaceRegistry (registry). -func RegisterInterfaces(registry codectypes.InterfaceRegistry) { - // register the implementations of Msg-type - registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgCreateMarkets{}, - &MsgUpdateMarkets{}, - &MsgParams{}, - ) - - msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) -} diff --git a/x/mm2/types/errors.go b/x/mm2/types/errors.go deleted file mode 100644 index effcebcf3..000000000 --- a/x/mm2/types/errors.go +++ /dev/null @@ -1,31 +0,0 @@ -package types - -import "fmt" - -// MarketAlreadyExistsError is an error indicating the given Market exists in state. -type MarketAlreadyExistsError struct { - ticker TickerString -} - -func NewMarketAlreadyExistsError(ticker TickerString) MarketAlreadyExistsError { - return MarketAlreadyExistsError{ticker: ticker} -} - -// Error returns the error string for MarketAlreadyExistsError. -func (e MarketAlreadyExistsError) Error() string { - return fmt.Sprintf("market already exists for ticker %s", e.ticker) -} - -// MarketDoesNotExistsError is an error indicating the given Market does not exist in state. -type MarketDoesNotExistsError struct { - ticker TickerString -} - -func NewMarketDoesNotExistsError(ticker TickerString) MarketDoesNotExistsError { - return MarketDoesNotExistsError{ticker: ticker} -} - -// Error returns the error string for MarketDoesNotExistsError. -func (e MarketDoesNotExistsError) Error() string { - return fmt.Sprintf("market does not exist for ticker %s", e.ticker) -} diff --git a/x/mm2/types/events.go b/x/mm2/types/events.go deleted file mode 100644 index 74e0ee560..000000000 --- a/x/mm2/types/events.go +++ /dev/null @@ -1,13 +0,0 @@ -package types - -// market map module event types - -const ( - EventTypeCreateMarket = "create_market" - EventTypeUpdateMarket = "update_market" - - AttributeKeyCurrencyPair = "currency_pair" - AttributeKeyDecimals = "decimals" - AttributeKeyMinProviderCount = "min_provider_count" - AttributeKeyMetadata = "metadata" -) diff --git a/x/mm2/types/genesis.go b/x/mm2/types/genesis.go deleted file mode 100644 index 2b073dd5b..000000000 --- a/x/mm2/types/genesis.go +++ /dev/null @@ -1,34 +0,0 @@ -package types - -// NewGenesisState returns an instance of GenesisState. -func NewGenesisState( - marketMap MarketMap, - lastUpdated uint64, - params Params, -) GenesisState { - return GenesisState{ - MarketMap: marketMap, - LastUpdated: lastUpdated, - Params: params, - } -} - -// ValidateBasic performs basic validation on the GenesisState. -func (gs *GenesisState) ValidateBasic() error { - if err := gs.MarketMap.ValidateBasic(); err != nil { - return err - } - - return gs.Params.ValidateBasic() -} - -// DefaultGenesisState returns the default genesis of the marketmap module. -func DefaultGenesisState() *GenesisState { - return &GenesisState{ - MarketMap: MarketMap{ - Markets: make(map[string]Market), - }, - LastUpdated: 0, - Params: DefaultParams(), - } -} diff --git a/x/mm2/types/genesis.pb.go b/x/mm2/types/genesis.pb.go deleted file mode 100644 index d9797d065..000000000 --- a/x/mm2/types/genesis.pb.go +++ /dev/null @@ -1,419 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/mm2/v1/genesis.proto - -package types - -import ( - fmt "fmt" - _ "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 - -// GenesisState defines the x/marketmap module's genesis state. -type GenesisState struct { - // MarketMap defines the global set of market configurations for all providers - // and markets. - MarketMap MarketMap `protobuf:"bytes,1,opt,name=market_map,json=marketMap,proto3" json:"market_map"` - // LastUpdated is the last block height that the market map was updated. - // This field can be used as an optimization for clients checking if there - // is a new update to the map. - LastUpdated uint64 `protobuf:"varint,2,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - // Params are the parameters for the x/marketmap module. - Params Params `protobuf:"bytes,3,opt,name=params,proto3" json:"params"` -} - -func (m *GenesisState) Reset() { *m = GenesisState{} } -func (m *GenesisState) String() string { return proto.CompactTextString(m) } -func (*GenesisState) ProtoMessage() {} -func (*GenesisState) Descriptor() ([]byte, []int) { - return fileDescriptor_fe64ae6b5a69dcd9, []int{0} -} -func (m *GenesisState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *GenesisState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenesisState.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 *GenesisState) XXX_Merge(src proto.Message) { - xxx_messageInfo_GenesisState.Merge(m, src) -} -func (m *GenesisState) XXX_Size() int { - return m.Size() -} -func (m *GenesisState) XXX_DiscardUnknown() { - xxx_messageInfo_GenesisState.DiscardUnknown(m) -} - -var xxx_messageInfo_GenesisState proto.InternalMessageInfo - -func (m *GenesisState) GetMarketMap() MarketMap { - if m != nil { - return m.MarketMap - } - return MarketMap{} -} - -func (m *GenesisState) GetLastUpdated() uint64 { - if m != nil { - return m.LastUpdated - } - return 0 -} - -func (m *GenesisState) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func init() { - proto.RegisterType((*GenesisState)(nil), "slinky.mm2.v1.GenesisState") -} - -func init() { proto.RegisterFile("slinky/mm2/v1/genesis.proto", fileDescriptor_fe64ae6b5a69dcd9) } - -var fileDescriptor_fe64ae6b5a69dcd9 = []byte{ - // 263 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2e, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0xcf, 0xcd, 0x35, 0xd2, 0x2f, 0x33, 0xd4, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, - 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x48, 0xea, 0xe5, 0xe6, 0x1a, 0xe9, - 0x95, 0x19, 0x4a, 0x89, 0xa4, 0xe7, 0xa7, 0xe7, 0x83, 0x65, 0xf4, 0x41, 0x2c, 0x88, 0x22, 0x29, - 0x29, 0x54, 0x13, 0x72, 0x13, 0x8b, 0xb2, 0x53, 0x4b, 0xb0, 0xcb, 0x15, 0x24, 0x16, 0x25, 0xe6, - 0x42, 0x0d, 0x57, 0x5a, 0xca, 0xc8, 0xc5, 0xe3, 0x0e, 0xb1, 0x2e, 0xb8, 0x24, 0xb1, 0x24, 0x55, - 0xc8, 0x96, 0x8b, 0x0b, 0xa2, 0x39, 0x3e, 0x37, 0xb1, 0x40, 0x82, 0x51, 0x81, 0x51, 0x83, 0xdb, - 0x48, 0x42, 0x0f, 0xc5, 0x09, 0x7a, 0xbe, 0x60, 0x05, 0xbe, 0x89, 0x05, 0x4e, 0x2c, 0x27, 0xee, - 0xc9, 0x33, 0x04, 0x71, 0xe6, 0xc2, 0x04, 0x84, 0x14, 0xb9, 0x78, 0x72, 0x12, 0x8b, 0x4b, 0xe2, - 0x4b, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x53, 0x24, 0x98, 0x14, 0x18, 0x35, 0x58, 0x82, 0xb8, 0x41, - 0x62, 0xa1, 0x10, 0x21, 0x21, 0x63, 0x2e, 0x36, 0x88, 0x13, 0x24, 0x98, 0xc1, 0xa6, 0x8b, 0xa2, - 0x99, 0x1e, 0x00, 0x96, 0x84, 0x1a, 0x0d, 0x55, 0xea, 0xe4, 0x70, 0xe2, 0x91, 0x1c, 0xe3, 0x85, - 0x47, 0x72, 0x8c, 0x0f, 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, - 0x8d, 0xc7, 0x72, 0x0c, 0x51, 0x6a, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, - 0xfa, 0xc5, 0xd9, 0x99, 0x05, 0xba, 0xb9, 0xa9, 0x65, 0xfa, 0x50, 0x1f, 0x57, 0x80, 0xfd, 0x5c, - 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0xf6, 0xb0, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x19, - 0x7a, 0x59, 0x1d, 0x6c, 0x01, 0x00, 0x00, -} - -func (m *GenesisState) 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 *GenesisState) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - if m.LastUpdated != 0 { - i = encodeVarintGenesis(dAtA, i, uint64(m.LastUpdated)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.MarketMap.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MarketMap.Size() - n += 1 + l + sovGenesis(uint64(l)) - if m.LastUpdated != 0 { - n += 1 + sovGenesis(uint64(m.LastUpdated)) - } - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *GenesisState) 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 ErrIntOverflowGenesis - } - 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: GenesisState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketMap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MarketMap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - m.LastUpdated = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastUpdated |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipGenesis(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthGenesis - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipGenesis(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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrIntOverflowGenesis - } - 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, ErrInvalidLengthGenesis - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupGenesis - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthGenesis - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthGenesis = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowGenesis = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupGenesis = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/mm2/types/genesis_test.go b/x/mm2/types/genesis_test.go deleted file mode 100644 index 7e3fb0232..000000000 --- a/x/mm2/types/genesis_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/mm2/types" -) - -func TestGenesisState(t *testing.T) { - t.Run("invalid empty genesis state - fail", func(t *testing.T) { - gs := types.GenesisState{} - require.Error(t, gs.ValidateBasic()) - }) - - t.Run("invalid params - fail", func(t *testing.T) { - gs := types.DefaultGenesisState() - - gs.Params.MarketAuthorities = []string{"invalid"} - require.Error(t, gs.ValidateBasic()) - }) - - t.Run("good populated genesis state", func(t *testing.T) { - gs := types.GenesisState{ - MarketMap: types.MarketMap{ - Markets: markets, - }, - Params: types.DefaultParams(), - } - require.NoError(t, gs.ValidateBasic()) - }) -} diff --git a/x/mm2/types/hooks.go b/x/mm2/types/hooks.go deleted file mode 100644 index 401d3b65e..000000000 --- a/x/mm2/types/hooks.go +++ /dev/null @@ -1,56 +0,0 @@ -package types - -import sdk "github.com/cosmos/cosmos-sdk/types" - -// MarketMapHooks is the interface that defines the hooks that can be integrated by other modules. -type MarketMapHooks interface { - // AfterMarketCreated is called after CreateMarket is called. - AfterMarketCreated(ctx sdk.Context, market Market) error - - // AfterMarketUpdated is called after UpdateMarket is called. - AfterMarketUpdated(ctx sdk.Context, market Market) error - - // AfterMarketGenesis is called after x/marketmap init genesis. - AfterMarketGenesis(ctx sdk.Context, tickers map[string]Market) error -} - -var _ MarketMapHooks = &MultiMarketMapHooks{} - -// MultiMarketMapHooks defines an array of MarketMapHooks which can be executed in sequence. -type MultiMarketMapHooks []MarketMapHooks - -// AfterMarketCreated calls all AfterMarketCreated hooks registered to the MultiMarketMapHooks. -func (mh MultiMarketMapHooks) AfterMarketCreated(ctx sdk.Context, market Market) error { - for i := range mh { - if err := mh[i].AfterMarketCreated(ctx, market); err != nil { - return err - } - } - - return nil -} - -// AfterMarketUpdated calls all AfterMarketUpdated hooks registered to the MultiMarketMapHooks. -func (mh MultiMarketMapHooks) AfterMarketUpdated(ctx sdk.Context, market Market) error { - for i := range mh { - if err := mh[i].AfterMarketUpdated(ctx, market); err != nil { - return err - } - } - - return nil -} - -// AfterMarketGenesis calls all AfterMarketGenesis hooks registered to the MultiMarketMapHooks. -func (mh MultiMarketMapHooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]Market) error { - for i := range mh { - if err := mh[i].AfterMarketGenesis(ctx, markets); err != nil { - return err - } - } - - return nil -} - -// MarketMapHooksWrapper is a wrapper for modules to inject MarketMapHooks using depinject. -type MarketMapHooksWrapper struct{ MarketMapHooks } diff --git a/x/mm2/types/keys.go b/x/mm2/types/keys.go deleted file mode 100644 index 85700ed5b..000000000 --- a/x/mm2/types/keys.go +++ /dev/null @@ -1,34 +0,0 @@ -package types - -import ( - "cosmossdk.io/collections" - "cosmossdk.io/collections/codec" -) - -const ( - // ModuleName defines the canonical name identifying the module. - ModuleName = "marketmap" - // StoreKey holds the unique key used to access the module keeper's KVStore. - StoreKey = ModuleName -) - -var ( - // LastUpdatedPrefix is the key prefix for the lastUpdated height. - LastUpdatedPrefix = collections.NewPrefix(1) - - // MarketsPrefix is the key prefix for Markets. - MarketsPrefix = collections.NewPrefix(2) - - // ParamsPrefix is the key prefix of the module Params. - ParamsPrefix = collections.NewPrefix(3) - - // TickersCodec is the collections.KeyCodec value used for the markets map. - TickersCodec = codec.NewStringKeyCodec[TickerString]() - - // LastUpdatedCodec is the collections.KeyCodec value used for the lastUpdated value. - LastUpdatedCodec = codec.KeyToValueCodec[uint64](codec.NewUint64Key[uint64]()) -) - -// TickerString is the key used to identify unique pairs of Base/Quote with corresponding PathsConfig objects--or in other words AggregationConfigs. -// The TickerString is identical to Slinky's CurrencyPair.String() output in that it is `Base` and `Quote` joined by `/` i.e. `$BASE/$QUOTE`. -type TickerString string diff --git a/x/mm2/types/market.go b/x/mm2/types/market.go deleted file mode 100644 index 7b79f76b3..000000000 --- a/x/mm2/types/market.go +++ /dev/null @@ -1,114 +0,0 @@ -package types - -import ( - "fmt" -) - -// ValidateBasic validates the market map configuration and its expected configuration. -// -// In particular, this will -// -// 1. Ensure that the market map is valid (ValidateBasic). This ensures that each of the provider's -// markets are supported by the market map. -// 2. Ensure that each provider config has a valid corresponding ticker. -func (mm *MarketMap) ValidateBasic() error { - for _, market := range mm.Markets { - if err := market.ValidateBasic(); err != nil { - return err - } - - for _, providerConfig := range market.ProviderConfigs { - if providerConfig.NormalizeByPair != nil { - if _, found := mm.Markets[providerConfig.NormalizeByPair.String()]; !found { - return fmt.Errorf("provider's (%s) pair for normalization (%s) was not found in the marketmap", providerConfig.Name, providerConfig.NormalizeByPair.String()) - } - } - } - } - - return nil -} - -// String returns the string representation of the market map. -func (mm *MarketMap) String() string { - return fmt.Sprintf( - "MarketMap: {Markets %v}", - mm.Markets, - ) -} - -// ValidateBasic performs stateless validation of a Market. -func (m *Market) ValidateBasic() error { - if err := m.Ticker.ValidateBasic(); err != nil { - return err - } - - if uint64(len(m.ProviderConfigs)) < m.Ticker.MinProviderCount { - return fmt.Errorf("this ticker must have at least %d providers; got %d", - m.Ticker.MinProviderCount, - len(m.ProviderConfigs), - ) - } - - seenProviders := make(map[string]struct{}) - for _, providerConfig := range m.ProviderConfigs { - if err := providerConfig.ValidateBasic(); err != nil { - return err - } - - // check for duplicate providers - if _, seen := seenProviders[providerConfig.Name]; seen { - return fmt.Errorf("duplicate provider found: %s", providerConfig.Name) - } - seenProviders[providerConfig.Name] = struct{}{} - - } - - return nil -} - -// String returns the string representation of the market. -func (m *Market) String() string { - return fmt.Sprintf( - "Market: {Ticker %v Providers: %v}", m.Ticker, m.ProviderConfigs, - ) -} - -// Equal returns true if the MarketMap is equal to the given MarketMap. -func (mm *MarketMap) Equal(other MarketMap) bool { - if len(mm.Markets) != len(other.Markets) { - return false - } - - for tickerStr, market := range mm.Markets { - otherMarket, found := other.Markets[tickerStr] - if !found { - return false - } - - if !market.Equal(otherMarket) { - return false - } - } - - return true -} - -// Equal returns true if the Market is equal to the given Market. -func (m *Market) Equal(other Market) bool { - if !m.Ticker.Equal(other.Ticker) { - return false - } - - if len(m.ProviderConfigs) != len(other.ProviderConfigs) { - return false - } - - for i, providerConfig := range m.ProviderConfigs { - if !providerConfig.Equal(other.ProviderConfigs[i]) { - return false - } - } - - return true -} diff --git a/x/mm2/types/market.pb.go b/x/mm2/types/market.pb.go deleted file mode 100644 index b1968ad04..000000000 --- a/x/mm2/types/market.pb.go +++ /dev/null @@ -1,1431 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/mm2/v1/market.proto - -package types - -import ( - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - types "github.com/skip-mev/slinky/pkg/types" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// Market encapsulates a Ticker and its provider-specific configuration. -type Market struct { - // Ticker represents a price feed for a given asset pair i.e. BTC/USD. The - // price feed is scaled to a number of decimal places and has a minimum number - // of providers required to consider the ticker valid. - Ticker Ticker `protobuf:"bytes,1,opt,name=ticker,proto3" json:"ticker"` - // ProviderConfigs is the list of provider-specific configs for this Market. - ProviderConfigs []ProviderConfig `protobuf:"bytes,2,rep,name=provider_configs,json=providerConfigs,proto3" json:"provider_configs"` -} - -func (m *Market) Reset() { *m = Market{} } -func (*Market) ProtoMessage() {} -func (*Market) Descriptor() ([]byte, []int) { - return fileDescriptor_446157c095b24f63, []int{0} -} -func (m *Market) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Market) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Market.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Market) XXX_Merge(src proto.Message) { - xxx_messageInfo_Market.Merge(m, src) -} -func (m *Market) XXX_Size() int { - return m.Size() -} -func (m *Market) XXX_DiscardUnknown() { - xxx_messageInfo_Market.DiscardUnknown(m) -} - -var xxx_messageInfo_Market proto.InternalMessageInfo - -func (m *Market) GetTicker() Ticker { - if m != nil { - return m.Ticker - } - return Ticker{} -} - -func (m *Market) GetProviderConfigs() []ProviderConfig { - if m != nil { - return m.ProviderConfigs - } - return nil -} - -// Ticker represents a price feed for a given asset pair i.e. BTC/USD. The price -// feed is scaled to a number of decimal places and has a minimum number of -// providers required to consider the ticker valid. -type Ticker struct { - // CurrencyPair is the currency pair for this ticker. - CurrencyPair types.CurrencyPair `protobuf:"bytes,1,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair"` - // Decimals is the number of decimal places for the ticker. The number of - // decimal places is used to convert the price to a human-readable format. - Decimals uint64 `protobuf:"varint,2,opt,name=decimals,proto3" json:"decimals,omitempty"` - // MinProviderCount is the minimum number of providers required to consider - // the ticker valid. - MinProviderCount uint64 `protobuf:"varint,3,opt,name=min_provider_count,json=minProviderCount,proto3" json:"min_provider_count,omitempty"` - // Enabled is the flag that denotes if the Ticker is enabled for price - // fetching by an oracle. - Enabled bool `protobuf:"varint,14,opt,name=enabled,proto3" json:"enabled,omitempty"` - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given ticker. - Metadata_JSON string `protobuf:"bytes,15,opt,name=metadata_JSON,json=metadataJSON,proto3" json:"metadata_JSON,omitempty"` -} - -func (m *Ticker) Reset() { *m = Ticker{} } -func (*Ticker) ProtoMessage() {} -func (*Ticker) Descriptor() ([]byte, []int) { - return fileDescriptor_446157c095b24f63, []int{1} -} -func (m *Ticker) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Ticker) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Ticker.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 *Ticker) XXX_Merge(src proto.Message) { - xxx_messageInfo_Ticker.Merge(m, src) -} -func (m *Ticker) XXX_Size() int { - return m.Size() -} -func (m *Ticker) XXX_DiscardUnknown() { - xxx_messageInfo_Ticker.DiscardUnknown(m) -} - -var xxx_messageInfo_Ticker proto.InternalMessageInfo - -func (m *Ticker) GetCurrencyPair() types.CurrencyPair { - if m != nil { - return m.CurrencyPair - } - return types.CurrencyPair{} -} - -func (m *Ticker) GetDecimals() uint64 { - if m != nil { - return m.Decimals - } - return 0 -} - -func (m *Ticker) GetMinProviderCount() uint64 { - if m != nil { - return m.MinProviderCount - } - return 0 -} - -func (m *Ticker) GetEnabled() bool { - if m != nil { - return m.Enabled - } - return false -} - -func (m *Ticker) GetMetadata_JSON() string { - if m != nil { - return m.Metadata_JSON - } - return "" -} - -type ProviderConfig struct { - // Name corresponds to the name of the provider for which the configuration is - // being set. - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - // OffChainTicker is the off-chain representation of the ticker i.e. BTC/USD. - // The off-chain ticker is unique to a given provider and is used to fetch the - // price of the ticker from the provider. - OffChainTicker string `protobuf:"bytes,2,opt,name=off_chain_ticker,json=offChainTicker,proto3" json:"off_chain_ticker,omitempty"` - // NormalizeByPair is the currency pair for this ticker to be normalized by. - // For example, if the desired Ticker is BTD/USD, this market could be reached - // using: OffChainTicker = BTC/USDT NormalizeByPair = USDT/USD This field is - // optional and nullable. - NormalizeByPair *types.CurrencyPair `protobuf:"bytes,3,opt,name=normalize_by_pair,json=normalizeByPair,proto3" json:"normalize_by_pair,omitempty"` - // Invert is a boolean indicating if the BASE and QUOTE of the market should - // be inverted. i.e. BASE -> QUOTE, QUOTE -> BASE - Invert bool `protobuf:"varint,4,opt,name=invert,proto3" json:"invert,omitempty"` - // MetadataJSON is a string of JSON that encodes any extra configuration - // for the given provider config. - Metadata_JSON string `protobuf:"bytes,15,opt,name=metadata_JSON,json=metadataJSON,proto3" json:"metadata_JSON,omitempty"` -} - -func (m *ProviderConfig) Reset() { *m = ProviderConfig{} } -func (m *ProviderConfig) String() string { return proto.CompactTextString(m) } -func (*ProviderConfig) ProtoMessage() {} -func (*ProviderConfig) Descriptor() ([]byte, []int) { - return fileDescriptor_446157c095b24f63, []int{2} -} -func (m *ProviderConfig) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ProviderConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ProviderConfig.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 *ProviderConfig) XXX_Merge(src proto.Message) { - xxx_messageInfo_ProviderConfig.Merge(m, src) -} -func (m *ProviderConfig) XXX_Size() int { - return m.Size() -} -func (m *ProviderConfig) XXX_DiscardUnknown() { - xxx_messageInfo_ProviderConfig.DiscardUnknown(m) -} - -var xxx_messageInfo_ProviderConfig proto.InternalMessageInfo - -func (m *ProviderConfig) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -func (m *ProviderConfig) GetOffChainTicker() string { - if m != nil { - return m.OffChainTicker - } - return "" -} - -func (m *ProviderConfig) GetNormalizeByPair() *types.CurrencyPair { - if m != nil { - return m.NormalizeByPair - } - return nil -} - -func (m *ProviderConfig) GetInvert() bool { - if m != nil { - return m.Invert - } - return false -} - -func (m *ProviderConfig) GetMetadata_JSON() string { - if m != nil { - return m.Metadata_JSON - } - return "" -} - -// MarketMap maps ticker strings to their Markets. -type MarketMap struct { - // Markets is the full list of tickers and their associated configurations - // to be stored on-chain. - Markets map[string]Market `protobuf:"bytes,1,rep,name=markets,proto3" json:"markets" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` -} - -func (m *MarketMap) Reset() { *m = MarketMap{} } -func (*MarketMap) ProtoMessage() {} -func (*MarketMap) Descriptor() ([]byte, []int) { - return fileDescriptor_446157c095b24f63, []int{3} -} -func (m *MarketMap) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MarketMap) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MarketMap.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 *MarketMap) XXX_Merge(src proto.Message) { - xxx_messageInfo_MarketMap.Merge(m, src) -} -func (m *MarketMap) XXX_Size() int { - return m.Size() -} -func (m *MarketMap) XXX_DiscardUnknown() { - xxx_messageInfo_MarketMap.DiscardUnknown(m) -} - -var xxx_messageInfo_MarketMap proto.InternalMessageInfo - -func (m *MarketMap) GetMarkets() map[string]Market { - if m != nil { - return m.Markets - } - return nil -} - -func init() { - proto.RegisterType((*Market)(nil), "slinky.mm2.v1.Market") - proto.RegisterType((*Ticker)(nil), "slinky.mm2.v1.Ticker") - proto.RegisterType((*ProviderConfig)(nil), "slinky.mm2.v1.ProviderConfig") - proto.RegisterType((*MarketMap)(nil), "slinky.mm2.v1.MarketMap") - proto.RegisterMapType((map[string]Market)(nil), "slinky.mm2.v1.MarketMap.MarketsEntry") -} - -func init() { proto.RegisterFile("slinky/mm2/v1/market.proto", fileDescriptor_446157c095b24f63) } - -var fileDescriptor_446157c095b24f63 = []byte{ - // 544 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x53, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xf6, 0x26, 0x21, 0x4d, 0xb6, 0xf9, 0x63, 0x05, 0xc8, 0x8a, 0x84, 0x1b, 0xa5, 0x02, 0x59, - 0x02, 0x6c, 0x35, 0xbd, 0xa0, 0x9e, 0x50, 0xa2, 0x4a, 0x80, 0xd4, 0x52, 0x0c, 0x27, 0x2e, 0xd6, - 0xc6, 0xd9, 0xa4, 0xab, 0x64, 0xd7, 0xd6, 0x7a, 0x63, 0x61, 0x4e, 0x3c, 0x02, 0x37, 0x38, 0xf2, - 0x06, 0xbc, 0x46, 0x8f, 0x3d, 0x21, 0x0e, 0x08, 0xa1, 0x44, 0xbc, 0x07, 0xf2, 0x7a, 0x93, 0x26, - 0xed, 0xa5, 0xb7, 0xd9, 0x99, 0x6f, 0x7e, 0xbe, 0x6f, 0x67, 0x60, 0x3b, 0x9e, 0x51, 0x3e, 0x4d, - 0x5d, 0xc6, 0x7a, 0x6e, 0x72, 0xe0, 0x32, 0x2c, 0xa6, 0x44, 0x3a, 0x91, 0x08, 0x65, 0x88, 0xea, - 0x79, 0xcc, 0x61, 0xac, 0xe7, 0x24, 0x07, 0xed, 0x7b, 0x93, 0x70, 0x12, 0xaa, 0x88, 0x9b, 0x59, - 0x39, 0xa8, 0xbd, 0xaf, 0x0b, 0xc8, 0x34, 0x22, 0x71, 0x56, 0x22, 0x98, 0x0b, 0x41, 0x78, 0x90, - 0xfa, 0x11, 0xa6, 0x22, 0x07, 0x75, 0xbf, 0x02, 0x58, 0x3e, 0x51, 0xa5, 0xd1, 0x21, 0x2c, 0x4b, - 0x1a, 0x4c, 0x89, 0x30, 0x41, 0x07, 0xd8, 0xbb, 0xbd, 0xfb, 0xce, 0x56, 0x17, 0xe7, 0xbd, 0x0a, - 0xf6, 0x4b, 0x17, 0x7f, 0xf6, 0x0c, 0x4f, 0x43, 0xd1, 0x29, 0x6c, 0x45, 0x22, 0x4c, 0xe8, 0x88, - 0x08, 0x3f, 0x08, 0xf9, 0x98, 0x4e, 0x62, 0xb3, 0xd0, 0x29, 0xda, 0xbb, 0xbd, 0x87, 0xd7, 0xd2, - 0xcf, 0x34, 0x6c, 0xa0, 0x50, 0xba, 0x4c, 0x33, 0xda, 0xf2, 0xc6, 0x47, 0x95, 0x6f, 0xdf, 0xf7, - 0x8c, 0xcf, 0xbf, 0x3b, 0x46, 0xf7, 0x1f, 0x80, 0xe5, 0xbc, 0x25, 0x7a, 0x09, 0xeb, 0x5b, 0xb3, - 0xeb, 0x01, 0xd7, 0x1d, 0x14, 0xc3, 0xac, 0xc7, 0x40, 0xa3, 0xce, 0x30, 0x5d, 0x0d, 0x5a, 0x0b, - 0x36, 0x7c, 0xa8, 0x0d, 0x2b, 0x23, 0x12, 0x50, 0x86, 0x67, 0xd9, 0x98, 0xc0, 0x2e, 0x79, 0xeb, - 0x37, 0x7a, 0x0a, 0x11, 0xa3, 0xdc, 0xdf, 0xa0, 0x33, 0xe7, 0xd2, 0x2c, 0x2a, 0x54, 0x8b, 0x51, - 0x7e, 0x45, 0x60, 0xce, 0x25, 0x32, 0xe1, 0x0e, 0xe1, 0x78, 0x38, 0x23, 0x23, 0xb3, 0xd1, 0x01, - 0x76, 0xc5, 0x5b, 0x3d, 0xd1, 0x3e, 0xac, 0x33, 0x22, 0xf1, 0x08, 0x4b, 0xec, 0xbf, 0x7e, 0xf7, - 0xe6, 0xd4, 0x6c, 0x76, 0x80, 0x5d, 0xf5, 0x6a, 0x2b, 0x67, 0xe6, 0xdb, 0xe0, 0xf9, 0x13, 0xc0, - 0xc6, 0xb6, 0x36, 0x08, 0xc1, 0x12, 0xc7, 0x8c, 0x28, 0x9a, 0x55, 0x4f, 0xd9, 0xc8, 0x86, 0xad, - 0x70, 0x3c, 0xf6, 0x83, 0x73, 0x4c, 0xb9, 0xaf, 0xff, 0xa9, 0xa0, 0xe2, 0x8d, 0x70, 0x3c, 0x1e, - 0x64, 0x6e, 0xad, 0xd6, 0x2b, 0x78, 0x97, 0x87, 0x82, 0xe1, 0x19, 0xfd, 0x44, 0xfc, 0xa1, 0x56, - 0xac, 0x78, 0x0b, 0xc5, 0xbc, 0xe6, 0x3a, 0xaf, 0x9f, 0xcb, 0xf5, 0x00, 0x96, 0x29, 0x4f, 0x88, - 0x90, 0x66, 0x49, 0x71, 0xd4, 0xaf, 0x5b, 0x51, 0xec, 0xfe, 0x00, 0xb0, 0x9a, 0xaf, 0xd6, 0x09, - 0x8e, 0xd0, 0x31, 0xdc, 0xc9, 0x57, 0x38, 0x36, 0x81, 0xda, 0x8f, 0x47, 0xd7, 0xf6, 0x63, 0x0d, - 0xd5, 0x56, 0x7c, 0xcc, 0xa5, 0x48, 0xf5, 0x2f, 0xae, 0x72, 0xdb, 0x6f, 0x61, 0x6d, 0x33, 0x8c, - 0x5a, 0xb0, 0x38, 0x25, 0xa9, 0x56, 0x2a, 0x33, 0xd1, 0x13, 0x78, 0x27, 0xc1, 0xb3, 0x39, 0x51, - 0xea, 0xdc, 0xdc, 0xe2, 0x3c, 0xdb, 0xcb, 0x31, 0x47, 0x85, 0xe7, 0xe0, 0xea, 0x2b, 0xfa, 0x2f, - 0x2e, 0x16, 0x16, 0xb8, 0x5c, 0x58, 0xe0, 0xef, 0xc2, 0x02, 0x5f, 0x96, 0x96, 0x71, 0xb9, 0xb4, - 0x8c, 0x5f, 0x4b, 0xcb, 0xf8, 0xf0, 0x78, 0x42, 0xe5, 0xf9, 0x7c, 0xe8, 0x04, 0x21, 0x73, 0xe3, - 0x29, 0x8d, 0x9e, 0x31, 0x92, 0xb8, 0xfa, 0xbe, 0x3e, 0xaa, 0x13, 0x55, 0x8a, 0x0e, 0xcb, 0xea, - 0xaa, 0x0e, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0x4e, 0x2d, 0xdf, 0x25, 0xbd, 0x03, 0x00, 0x00, -} - -func (m *Market) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Market) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Market) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ProviderConfigs) > 0 { - for iNdEx := len(m.ProviderConfigs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ProviderConfigs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - { - size, err := m.Ticker.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *Ticker) 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 *Ticker) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Ticker) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Metadata_JSON) > 0 { - i -= len(m.Metadata_JSON) - copy(dAtA[i:], m.Metadata_JSON) - i = encodeVarintMarket(dAtA, i, uint64(len(m.Metadata_JSON))) - i-- - dAtA[i] = 0x7a - } - if m.Enabled { - i-- - if m.Enabled { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x70 - } - if m.MinProviderCount != 0 { - i = encodeVarintMarket(dAtA, i, uint64(m.MinProviderCount)) - i-- - dAtA[i] = 0x18 - } - if m.Decimals != 0 { - i = encodeVarintMarket(dAtA, i, uint64(m.Decimals)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.CurrencyPair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ProviderConfig) 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 *ProviderConfig) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ProviderConfig) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Metadata_JSON) > 0 { - i -= len(m.Metadata_JSON) - copy(dAtA[i:], m.Metadata_JSON) - i = encodeVarintMarket(dAtA, i, uint64(len(m.Metadata_JSON))) - i-- - dAtA[i] = 0x7a - } - if m.Invert { - i-- - if m.Invert { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i-- - dAtA[i] = 0x20 - } - if m.NormalizeByPair != nil { - { - size, err := m.NormalizeByPair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - } - if len(m.OffChainTicker) > 0 { - i -= len(m.OffChainTicker) - copy(dAtA[i:], m.OffChainTicker) - i = encodeVarintMarket(dAtA, i, uint64(len(m.OffChainTicker))) - i-- - dAtA[i] = 0x12 - } - if len(m.Name) > 0 { - i -= len(m.Name) - copy(dAtA[i:], m.Name) - i = encodeVarintMarket(dAtA, i, uint64(len(m.Name))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MarketMap) 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 *MarketMap) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MarketMap) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Markets) > 0 { - for k := range m.Markets { - v := m.Markets[k] - baseI := i - { - size, err := (&v).MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintMarket(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - i -= len(k) - copy(dAtA[i:], k) - i = encodeVarintMarket(dAtA, i, uint64(len(k))) - i-- - dAtA[i] = 0xa - i = encodeVarintMarket(dAtA, i, uint64(baseI-i)) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintMarket(dAtA []byte, offset int, v uint64) int { - offset -= sovMarket(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Market) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Ticker.Size() - n += 1 + l + sovMarket(uint64(l)) - if len(m.ProviderConfigs) > 0 { - for _, e := range m.ProviderConfigs { - l = e.Size() - n += 1 + l + sovMarket(uint64(l)) - } - } - return n -} - -func (m *Ticker) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CurrencyPair.Size() - n += 1 + l + sovMarket(uint64(l)) - if m.Decimals != 0 { - n += 1 + sovMarket(uint64(m.Decimals)) - } - if m.MinProviderCount != 0 { - n += 1 + sovMarket(uint64(m.MinProviderCount)) - } - if m.Enabled { - n += 2 - } - l = len(m.Metadata_JSON) - if l > 0 { - n += 1 + l + sovMarket(uint64(l)) - } - return n -} - -func (m *ProviderConfig) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovMarket(uint64(l)) - } - l = len(m.OffChainTicker) - if l > 0 { - n += 1 + l + sovMarket(uint64(l)) - } - if m.NormalizeByPair != nil { - l = m.NormalizeByPair.Size() - n += 1 + l + sovMarket(uint64(l)) - } - if m.Invert { - n += 2 - } - l = len(m.Metadata_JSON) - if l > 0 { - n += 1 + l + sovMarket(uint64(l)) - } - return n -} - -func (m *MarketMap) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Markets) > 0 { - for k, v := range m.Markets { - _ = k - _ = v - l = v.Size() - mapEntrySize := 1 + len(k) + sovMarket(uint64(len(k))) + 1 + l + sovMarket(uint64(l)) - n += mapEntrySize + 1 + sovMarket(uint64(mapEntrySize)) - } - } - return n -} - -func sovMarket(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozMarket(x uint64) (n int) { - return sovMarket(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Market) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Market: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Market: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Ticker.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ProviderConfigs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ProviderConfigs = append(m.ProviderConfigs, ProviderConfig{}) - if err := m.ProviderConfigs[len(m.ProviderConfigs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Ticker) 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 ErrIntOverflowMarket - } - 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: Ticker: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Ticker: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Decimals", wireType) - } - m.Decimals = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Decimals |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinProviderCount", wireType) - } - m.MinProviderCount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinProviderCount |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 14: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Enabled = bool(v != 0) - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata_JSON = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ProviderConfig) 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 ErrIntOverflowMarket - } - 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: ProviderConfig: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ProviderConfig: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field OffChainTicker", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.OffChainTicker = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NormalizeByPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.NormalizeByPair == nil { - m.NormalizeByPair = &types.CurrencyPair{} - } - if err := m.NormalizeByPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Invert", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - m.Invert = bool(v != 0) - case 15: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Metadata_JSON", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - 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 ErrInvalidLengthMarket - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Metadata_JSON = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MarketMap) 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 ErrIntOverflowMarket - } - 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: MarketMap: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MarketMap: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Markets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthMarket - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthMarket - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Markets == nil { - m.Markets = make(map[string]Market) - } - var mapkey string - mapvalue := &Market{} - for iNdEx < postIndex { - entryPreIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - if fieldNum == 1 { - var stringLenmapkey uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLenmapkey |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLenmapkey := int(stringLenmapkey) - if intStringLenmapkey < 0 { - return ErrInvalidLengthMarket - } - postStringIndexmapkey := iNdEx + intStringLenmapkey - if postStringIndexmapkey < 0 { - return ErrInvalidLengthMarket - } - if postStringIndexmapkey > l { - return io.ErrUnexpectedEOF - } - mapkey = string(dAtA[iNdEx:postStringIndexmapkey]) - iNdEx = postStringIndexmapkey - } else if fieldNum == 2 { - var mapmsglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowMarket - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - mapmsglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if mapmsglen < 0 { - return ErrInvalidLengthMarket - } - postmsgIndex := iNdEx + mapmsglen - if postmsgIndex < 0 { - return ErrInvalidLengthMarket - } - if postmsgIndex > l { - return io.ErrUnexpectedEOF - } - mapvalue = &Market{} - if err := mapvalue.Unmarshal(dAtA[iNdEx:postmsgIndex]); err != nil { - return err - } - iNdEx = postmsgIndex - } else { - iNdEx = entryPreIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > postIndex { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - m.Markets[mapkey] = *mapvalue - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipMarket(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthMarket - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipMarket(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, ErrIntOverflowMarket - } - 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, ErrIntOverflowMarket - } - 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, ErrIntOverflowMarket - } - 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, ErrInvalidLengthMarket - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupMarket - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthMarket - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthMarket = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowMarket = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupMarket = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/mm2/types/market_test.go b/x/mm2/types/market_test.go deleted file mode 100644 index 1038f177c..000000000 --- a/x/mm2/types/market_test.go +++ /dev/null @@ -1,330 +0,0 @@ -package types_test - -import ( - "testing" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/oracle/constants" - "github.com/skip-mev/slinky/providers/apis/coinbase" - "github.com/skip-mev/slinky/x/mm2/types" -) - -var ( - btcusdt = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-usdt", - }, - }, - } - - btcusd = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-usdt", - NormalizeByPair: &usdtusd.Ticker.CurrencyPair, - }, - }, - } - - usdtusd = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDT", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "usdt-usd", - }, - }, - } - - usdcusd = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "USDC", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "usdc-usd", - }, - }, - } - - ethusdt = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "eth-usdt", - }, - }, - } - - ethusd = types.Market{ - Ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USD", - }, - Decimals: 8, - MinProviderCount: 3, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "eth-usdt", - NormalizeByPair: &usdtusd.Ticker.CurrencyPair, - }, - { - Name: "binance", - OffChainTicker: "eth-usdt", - NormalizeByPair: &usdtusd.Ticker.CurrencyPair, - }, - { - Name: "mexc", - OffChainTicker: "eth-usdt", - NormalizeByPair: &usdtusd.Ticker.CurrencyPair, - }, - }, - } - - markets = map[string]types.Market{ - btcusdt.Ticker.String(): btcusdt, - btcusd.Ticker.String(): btcusd, - usdtusd.Ticker.String(): usdtusd, - usdcusd.Ticker.String(): usdcusd, - ethusdt.Ticker.String(): ethusdt, - ethusd.Ticker.String(): ethusd, - } -) - -func TestMarketMapValidateBasic(t *testing.T) { - testCases := []struct { - name string - marketMap types.MarketMap - expectErr bool - }{ - { - name: "valid empty", - marketMap: types.MarketMap{}, - expectErr: false, - }, - { - name: "valid map", - marketMap: types.MarketMap{ - Markets: markets, - }, - expectErr: false, - }, - { - name: "market with no ticker", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - constants.BITCOIN_USD.String(): { - ProviderConfigs: []types.ProviderConfig{ - { - Name: coinbase.Name, - OffChainTicker: "BTC-USD", - }, - }, - }, - }, - }, - expectErr: true, - }, - { - name: "empty market", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - constants.BITCOIN_USD.String(): {}, - }, - }, - expectErr: true, - }, - { - name: "provider config includes a ticker that is not supported", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - constants.BITCOIN_USD.String(): { - Ticker: types.Ticker(constants.BITCOIN_USD), - ProviderConfigs: []types.ProviderConfig{ - { - Name: coinbase.Name, - OffChainTicker: "btc-usd", - NormalizeByPair: &slinkytypes.CurrencyPair{Base: "not", Quote: "real"}, - Invert: false, - Metadata_JSON: "", - }, - }, - }, - }, - }, - expectErr: true, - }, - { - name: "empty provider name", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - constants.BITCOIN_USD.String(): { - Ticker: types.Ticker(constants.BITCOIN_USD), - ProviderConfigs: []types.ProviderConfig{ - { - Name: "", - OffChainTicker: "btc-usd", - Invert: false, - Metadata_JSON: "", - }, - }, - }, - }, - }, - expectErr: true, - }, - { - name: "no provider configs", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - constants.BITCOIN_USD.String(): { - Ticker: types.Ticker(constants.BITCOIN_USD), - ProviderConfigs: []types.ProviderConfig{}, - }, - }, - }, - expectErr: true, - }, - { - name: "valid single provider", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - constants.BITCOIN_USD.String(): { - Ticker: types.Ticker(constants.BITCOIN_USD), - ProviderConfigs: []types.ProviderConfig{ - { - Name: coinbase.Name, - OffChainTicker: "BTC-USD", - }, - }, - }, - }, - }, - expectErr: false, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.marketMap.ValidateBasic() - if tc.expectErr { - require.Error(t, err) - } else { - require.NoError(t, err) - } - }) - } -} - -func TestMarketMapEqual(t *testing.T) { - cases := []struct { - name string - marketMap types.MarketMap - other types.MarketMap - expect bool - }{ - { - name: "empty market map", - marketMap: types.MarketMap{}, - other: types.MarketMap{}, - expect: true, - }, - { - name: "same market map", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - ethusdt.Ticker.String(): ethusdt, - }, - }, - other: types.MarketMap{ - Markets: map[string]types.Market{ - ethusdt.Ticker.String(): ethusdt, - }, - }, - expect: true, - }, - { - name: "different tickers", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - ethusdt.Ticker.String(): ethusdt, - }, - }, - other: types.MarketMap{ - Markets: map[string]types.Market{ - btcusdt.Ticker.String(): btcusdt, - }, - }, - expect: false, - }, - { - name: "different providers", - marketMap: types.MarketMap{ - Markets: map[string]types.Market{ - ethusdt.Ticker.String(): ethusdt, - }, - }, - other: types.MarketMap{ - Markets: map[string]types.Market{ - ethusdt.Ticker.String(): { - Ticker: ethusdt.Ticker, - ProviderConfigs: btcusdt.ProviderConfigs, - }, - }, - }, - expect: false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.expect, tc.marketMap.Equal(tc.other)) - }) - } -} diff --git a/x/mm2/types/msg.go b/x/mm2/types/msg.go deleted file mode 100644 index b68120334..000000000 --- a/x/mm2/types/msg.go +++ /dev/null @@ -1,95 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -var ( - _ sdk.Msg = &MsgCreateMarkets{} - _ sdk.Msg = &MsgUpdateMarkets{} - _ sdk.Msg = &MsgParams{} - _ sdk.Msg = &MsgRemoveMarketAuthorities{} -) - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the signer is a valid acc-address. -func (m *MsgCreateMarkets) ValidateBasic() error { - // validate signer address - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return err - } - - if len(m.CreateMarkets) == 0 { - return fmt.Errorf("no markets to create") - } - - for _, market := range m.CreateMarkets { - if err := market.ValidateBasic(); err != nil { - return err - } - } - - return nil -} - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the signer is a valid acc-address. -func (m *MsgUpdateMarkets) ValidateBasic() error { - // validate signer address - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return err - } - - if len(m.UpdateMarkets) == 0 { - return fmt.Errorf("no markets to update") - } - - for _, market := range m.UpdateMarkets { - if err := market.ValidateBasic(); err != nil { - return err - } - } - - return nil -} - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the signer is a valid acc-address. -func (m *MsgParams) ValidateBasic() error { - // validate signer address - if _, err := sdk.AccAddressFromBech32(m.Authority); err != nil { - return err - } - - return m.Params.ValidateBasic() -} - -// ValidateBasic determines whether the information in the message is formatted correctly, specifically -// whether the signer is a valid acc-address. -func (m *MsgRemoveMarketAuthorities) ValidateBasic() error { - // validate signer address - if _, err := sdk.AccAddressFromBech32(m.Admin); err != nil { - return err - } - - if len(m.RemoveAddresses) == 0 { - return fmt.Errorf("addresses to remove cannot be nil") - } - - seenAuthorities := make(map[string]struct{}, len(m.RemoveAddresses)) - for _, authority := range m.RemoveAddresses { - if _, seen := seenAuthorities[authority]; seen { - return fmt.Errorf("duplicate address %s found", authority) - } - - if _, err := sdk.AccAddressFromBech32(authority); err != nil { - return fmt.Errorf("invalid market authority string: %w", err) - } - - seenAuthorities[authority] = struct{}{} - } - - return nil -} diff --git a/x/mm2/types/msg_test.go b/x/mm2/types/msg_test.go deleted file mode 100644 index d4b368e9a..000000000 --- a/x/mm2/types/msg_test.go +++ /dev/null @@ -1,382 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/skip-mev/chaintestutil/sample" - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/mm2/types" -) - -func TestValidateBasicMsgCreateMarket(t *testing.T) { - validCurrencyPair := slinkytypes.CurrencyPair{ - Base: "BTC", - Quote: "ETH", - } - - validTicker := types.Ticker{ - CurrencyPair: validCurrencyPair, - Decimals: 8, - MinProviderCount: 2, - } - - tcs := []struct { - name string - msg types.MsgCreateMarkets - expectPass bool - }{ - { - "if the authority is not an acc-address - fail", - types.MsgCreateMarkets{ - Authority: "invalid", - }, - false, - }, - { - "if there are no creates - fail", - types.MsgCreateMarkets{ - Authority: sample.Address(sample.Rand()), - }, - false, - }, - { - "invalid ticker (0 decimals) - fail", - types.MsgCreateMarkets{ - Authority: sample.Address(sample.Rand()), - CreateMarkets: []types.Market{ - { - Ticker: types.Ticker{ - CurrencyPair: validCurrencyPair, - Decimals: 0, - MinProviderCount: 0, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "btceth", - }, - }, - }, - }, - }, - false, - }, - { - "invalid num providers (need more than 1) - fail", - types.MsgCreateMarkets{ - Authority: sample.Address(sample.Rand()), - CreateMarkets: []types.Market{ - { - Ticker: validTicker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - }, - }, - }, - }, - false, - }, - { - "invalid empty off-chain ticker - fail", - types.MsgCreateMarkets{ - Authority: sample.Address(sample.Rand()), - CreateMarkets: []types.Market{ - { - Ticker: validTicker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "", - }, - }, - }, - }, - }, - false, - }, - { - "valid message", - types.MsgCreateMarkets{ - Authority: sample.Address(sample.Rand()), - CreateMarkets: []types.Market{ - { - Ticker: validTicker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "btceth", - }, - }, - }, - }, - }, - true, - }, - } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - err := tc.msg.ValidateBasic() - if !tc.expectPass { - require.NotNil(t, err) - } else { - require.Nil(t, err) - } - }) - } -} - -func TestValidateBasicMsgUpdateMarket(t *testing.T) { - validCurrencyPair := slinkytypes.CurrencyPair{ - Base: "BTC", - Quote: "ETH", - } - - validTicker := types.Ticker{ - CurrencyPair: validCurrencyPair, - Decimals: 8, - MinProviderCount: 2, - } - - tcs := []struct { - name string - msg types.MsgUpdateMarkets - expectPass bool - }{ - { - "if the Authority is not an acc-address - fail", - types.MsgUpdateMarkets{ - Authority: "invalid", - }, - false, - }, - { - "if there are no creates - fail", - types.MsgUpdateMarkets{ - Authority: sample.Address(sample.Rand()), - }, - false, - }, - { - "invalid ticker (decimals) - fail", - types.MsgUpdateMarkets{ - Authority: sample.Address(sample.Rand()), - UpdateMarkets: []types.Market{ - { - Ticker: types.Ticker{ - CurrencyPair: validCurrencyPair, - Decimals: 0, - MinProviderCount: 0, - }, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "btceth", - }, - }, - }, - }, - }, - false, - }, - { - "invalid num providers (need more than 1) - fail", - types.MsgUpdateMarkets{ - Authority: sample.Address(sample.Rand()), - UpdateMarkets: []types.Market{ - { - Ticker: validTicker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - }, - }, - }, - }, - false, - }, - { - "invalid empty offchain ticker - fail", - types.MsgUpdateMarkets{ - Authority: sample.Address(sample.Rand()), - UpdateMarkets: []types.Market{ - { - Ticker: validTicker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "", - }, - }, - }, - }, - }, - false, - }, - { - "valid message", - types.MsgUpdateMarkets{ - Authority: sample.Address(sample.Rand()), - UpdateMarkets: []types.Market{ - { - Ticker: validTicker, - ProviderConfigs: []types.ProviderConfig{ - { - Name: "kucoin", - OffChainTicker: "btc-eth", - }, - { - Name: "mexc", - OffChainTicker: "btceth", - }, - }, - }, - }, - }, - true, - }, - } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - err := tc.msg.ValidateBasic() - if !tc.expectPass { - require.NotNil(t, err) - } else { - require.Nil(t, err) - } - }) - } -} - -func TestValidateBasicMsgParams(t *testing.T) { - rng := sample.Rand() - - tcs := []struct { - name string - msg types.MsgParams - expectPass bool - }{ - { - "if the Authority is not an acc-address - fail", - types.MsgParams{ - Authority: "invalid", - }, - false, - }, - { - name: "invalid params (no authorities) - fail", - msg: types.MsgParams{ - Params: types.Params{ - MarketAuthorities: nil, - }, - Authority: sample.Address(rng), - }, - expectPass: false, - }, - { - name: "valid params", - msg: types.MsgParams{ - Params: types.Params{ - MarketAuthorities: []string{sample.Address(rng)}, - Admin: sample.Address(rng), - }, - Authority: sample.Address(rng), - }, - expectPass: true, - }, - } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - err := tc.msg.ValidateBasic() - if !tc.expectPass { - require.NotNil(t, err) - } else { - require.Nil(t, err) - } - }) - } -} - -func TestValidateBasicMsgRemoveMarketAuthorities(t *testing.T) { - rng := sample.Rand() - - sampleAuth := sample.Address(rng) - - tcs := []struct { - name string - msg types.MsgRemoveMarketAuthorities - expectPass bool - }{ - { - "if the Admin is not an acc-address - fail", - types.MsgRemoveMarketAuthorities{ - Admin: "invalid", - }, - false, - }, - { - name: "invalid message (no authorities) - fail", - msg: types.MsgRemoveMarketAuthorities{ - RemoveAddresses: nil, - Admin: sample.Address(rng), - }, - expectPass: false, - }, - { - name: "valid message", - msg: types.MsgRemoveMarketAuthorities{ - RemoveAddresses: []string{sample.Address(rng)}, - Admin: sample.Address(rng), - }, - expectPass: true, - }, - { - name: "invalid message (duplicate authorities", - msg: types.MsgRemoveMarketAuthorities{ - RemoveAddresses: []string{sampleAuth, sampleAuth}, - Admin: sample.Address(rng), - }, - expectPass: false, - }, - } - - for _, tc := range tcs { - t.Run(tc.name, func(t *testing.T) { - err := tc.msg.ValidateBasic() - if !tc.expectPass { - require.NotNil(t, err) - } else { - require.Nil(t, err) - } - }) - } -} diff --git a/x/mm2/types/params.go b/x/mm2/types/params.go deleted file mode 100644 index adcc93bcc..000000000 --- a/x/mm2/types/params.go +++ /dev/null @@ -1,62 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" -) - -var ( - // DefaultMarketAuthority is the default value for the market authority Param. - DefaultMarketAuthority = authtypes.NewModuleAddress(govtypes.ModuleName).String() - // DefaultAdmin is the default value for the market admin Param. - DefaultAdmin = authtypes.NewModuleAddress(govtypes.ModuleName).String() -) - -// DefaultParams returns default marketmap parameters. -func DefaultParams() Params { - return Params{ - MarketAuthorities: []string{DefaultMarketAuthority}, - Admin: DefaultAdmin, - } -} - -// NewParams returns a new Params instance. -func NewParams(authorities []string, admin string) (Params, error) { - if authorities == nil { - return Params{}, fmt.Errorf("cannot create Params with nil authority") - } - - return Params{ - MarketAuthorities: authorities, - Admin: admin, - }, nil -} - -// ValidateBasic performs stateless validation of the Params. -func (p *Params) ValidateBasic() error { - if p.MarketAuthorities == nil { - return fmt.Errorf("cannot create Params with empty market authorities") - } - - seenAuthorities := make(map[string]struct{}, len(p.MarketAuthorities)) - for _, authority := range p.MarketAuthorities { - if _, seen := seenAuthorities[authority]; seen { - return fmt.Errorf("duplicate authority %s found", authority) - } - - if _, err := sdk.AccAddressFromBech32(authority); err != nil { - return fmt.Errorf("invalid market authority string: %w", err) - } - - seenAuthorities[authority] = struct{}{} - } - - if _, err := sdk.AccAddressFromBech32(p.Admin); err != nil { - return fmt.Errorf("invalid marketmap admin string: %w", err) - } - - return nil -} diff --git a/x/mm2/types/params.pb.go b/x/mm2/types/params.pb.go deleted file mode 100644 index b8102ac13..000000000 --- a/x/mm2/types/params.pb.go +++ /dev/null @@ -1,376 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/mm2/v1/params.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 - -// Params defines the parameters for the x/marketmap module. -type Params struct { - // MarketAuthorities is the list of authority accounts that are able to - // control updating the marketmap. - MarketAuthorities []string `protobuf:"bytes,1,rep,name=market_authorities,json=marketAuthorities,proto3" json:"market_authorities,omitempty"` - // Admin is an address that can remove addresses from the MarketAuthorities - // list. Only governance can add to the MarketAuthorities or change the Admin. - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (m *Params) String() string { return proto.CompactTextString(m) } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_e6f076fe60563dd2, []int{0} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.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 *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetMarketAuthorities() []string { - if m != nil { - return m.MarketAuthorities - } - return nil -} - -func (m *Params) GetAdmin() string { - if m != nil { - return m.Admin - } - return "" -} - -func init() { - proto.RegisterType((*Params)(nil), "slinky.mm2.v1.Params") -} - -func init() { proto.RegisterFile("slinky/mm2/v1/params.proto", fileDescriptor_e6f076fe60563dd2) } - -var fileDescriptor_e6f076fe60563dd2 = []byte{ - // 188 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2a, 0xce, 0xc9, 0xcc, - 0xcb, 0xae, 0xd4, 0xcf, 0xcd, 0x35, 0xd2, 0x2f, 0x33, 0xd4, 0x2f, 0x48, 0x2c, 0x4a, 0xcc, 0x2d, - 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0xc8, 0xe9, 0xe5, 0xe6, 0x1a, 0xe9, 0x95, - 0x19, 0x2a, 0xf9, 0x72, 0xb1, 0x05, 0x80, 0xa5, 0x85, 0x74, 0xb9, 0x84, 0x72, 0x13, 0x8b, 0xb2, - 0x53, 0x4b, 0xe2, 0x13, 0x4b, 0x4b, 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x32, 0x53, 0x8b, 0x25, 0x18, - 0x15, 0x98, 0x35, 0x38, 0x83, 0x04, 0x21, 0x32, 0x8e, 0x08, 0x09, 0x21, 0x11, 0x2e, 0xd6, 0xc4, - 0x94, 0xdc, 0xcc, 0x3c, 0x09, 0x26, 0x05, 0x46, 0x0d, 0xce, 0x20, 0x08, 0xc7, 0xc9, 0xe1, 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, 0xd4, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, - 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0x8b, 0xb3, 0x33, 0x0b, 0x74, 0x73, 0x53, 0xcb, 0xf4, 0xa1, 0xee, - 0xac, 0x00, 0xbb, 0xb4, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x4c, 0x63, 0x40, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x96, 0x08, 0xba, 0x00, 0xc4, 0x00, 0x00, 0x00, -} - -func (m *Params) 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 *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Admin) > 0 { - i -= len(m.Admin) - copy(dAtA[i:], m.Admin) - i = encodeVarintParams(dAtA, i, uint64(len(m.Admin))) - i-- - dAtA[i] = 0x12 - } - if len(m.MarketAuthorities) > 0 { - for iNdEx := len(m.MarketAuthorities) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.MarketAuthorities[iNdEx]) - copy(dAtA[i:], m.MarketAuthorities[iNdEx]) - i = encodeVarintParams(dAtA, i, uint64(len(m.MarketAuthorities[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func encodeVarintParams(dAtA []byte, offset int, v uint64) int { - offset -= sovParams(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.MarketAuthorities) > 0 { - for _, s := range m.MarketAuthorities { - l = len(s) - n += 1 + l + sovParams(uint64(l)) - } - } - l = len(m.Admin) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func sovParams(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozParams(x uint64) (n int) { - return sovParams(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *Params) 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 ErrIntOverflowParams - } - 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: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketAuthorities", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.MarketAuthorities = append(m.MarketAuthorities, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Admin", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - 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 ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Admin = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipParams(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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrIntOverflowParams - } - 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, ErrInvalidLengthParams - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupParams - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthParams - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthParams = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowParams = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupParams = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/mm2/types/params_test.go b/x/mm2/types/params_test.go deleted file mode 100644 index 31ad9b616..000000000 --- a/x/mm2/types/params_test.go +++ /dev/null @@ -1,83 +0,0 @@ -package types_test - -import ( - "testing" - - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" - - "github.com/skip-mev/slinky/x/mm2/types" -) - -func TestValidateBasic(t *testing.T) { - type testCase struct { - name string - params types.Params - expectErr bool - } - - testCases := []testCase{ - { - name: "valid default params", - params: types.DefaultParams(), - expectErr: false, - }, - { - name: "valid multiple authorities", - params: types.Params{ - MarketAuthorities: []string{authtypes.NewModuleAddress(authtypes.ModuleName).String(), types.DefaultMarketAuthority}, - Admin: types.DefaultAdmin, - }, - expectErr: false, - }, - { - name: "invalid admin", - params: types.Params{ - MarketAuthorities: []string{authtypes.NewModuleAddress(authtypes.ModuleName).String(), types.DefaultMarketAuthority}, - Admin: "invalid", - }, - expectErr: true, - }, - { - name: "invalid duplicate authority", - params: types.Params{ - MarketAuthorities: []string{types.DefaultMarketAuthority, types.DefaultMarketAuthority}, - Admin: types.DefaultAdmin, - }, - expectErr: true, - }, - { - name: "invalid authority string", - params: types.Params{ - MarketAuthorities: []string{"incorrect"}, - Admin: types.DefaultAdmin, - }, - expectErr: true, - }, - { - name: "invalid nil authority", - params: types.Params{ - MarketAuthorities: nil, - Admin: types.DefaultAdmin, - }, - expectErr: true, - }, - { - name: "invalid empty params", - params: types.Params{}, - expectErr: true, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.params.ValidateBasic() - if tc.expectErr { - require.Error(t, err) - return - } - - require.NoError(t, err) - }) - } -} diff --git a/x/mm2/types/provider.go b/x/mm2/types/provider.go deleted file mode 100644 index ab1fb7e3c..000000000 --- a/x/mm2/types/provider.go +++ /dev/null @@ -1,66 +0,0 @@ -package types - -import ( - "fmt" - - "github.com/skip-mev/slinky/pkg/json" -) - -// ValidateBasic performs basic validation on a ProviderConfig. -func (pc *ProviderConfig) ValidateBasic() error { - if len(pc.Name) == 0 { - return fmt.Errorf("provider name must not be empty") - } - - if len(pc.OffChainTicker) == 0 { - return fmt.Errorf("provider offchain ticker must not be empty") - } - - // NormalizeByPair is allowed to be empty - if pc.NormalizeByPair != nil { - if err := pc.NormalizeByPair.ValidateBasic(); err != nil { - return err - } - } - - if len(pc.Metadata_JSON) > MaxMetadataJSONFieldLength { - return fmt.Errorf("metadata json field is longer than maximum length of %d", MaxMetadataJSONFieldLength) - } - - if err := json.IsValid([]byte(pc.Metadata_JSON)); err != nil { - return fmt.Errorf("invalid provider config metadata json: %w", err) - } - - return nil -} - -// Equal returns true iff the ProviderConfig is equal to the given ProviderConfig. -func (pc *ProviderConfig) Equal(other ProviderConfig) bool { - if pc.Name != other.Name { - return false - } - - if pc.OffChainTicker != other.OffChainTicker { - return false - } - - if pc.Invert != other.Invert { - return false - } - - if pc.NormalizeByPair == nil { - if other.NormalizeByPair != nil { - return false - } - } else { - if other.NormalizeByPair == nil { - return false - } - - if !pc.NormalizeByPair.Equal(*other.NormalizeByPair) { - return false - } - } - - return pc.Metadata_JSON == other.Metadata_JSON -} diff --git a/x/mm2/types/provider_test.go b/x/mm2/types/provider_test.go deleted file mode 100644 index 62bd8e617..000000000 --- a/x/mm2/types/provider_test.go +++ /dev/null @@ -1,233 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/testutil" - "github.com/skip-mev/slinky/x/mm2/types" -) - -func TestProviderConfigValidateBasic(t *testing.T) { - t.Run("valid config - pass", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "", - } - require.NoError(t, pc.ValidateBasic()) - }) - t.Run("valid config inverted - pass", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Invert: true, - Metadata_JSON: "", - } - require.NoError(t, pc.ValidateBasic()) - }) - t.Run("valid config with normalize by - pass", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - Metadata_JSON: "", - } - require.NoError(t, pc.ValidateBasic()) - }) - t.Run("invalid config with normalize by - fail", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "", - }, - Metadata_JSON: "", - } - require.Error(t, pc.ValidateBasic()) - }) - t.Run("invalid name - fail", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "", - OffChainTicker: "ticker", - Metadata_JSON: "", - } - require.Error(t, pc.ValidateBasic()) - }) - t.Run("invalid offchain ticker - fail", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "", - Metadata_JSON: "", - } - require.Error(t, pc.ValidateBasic()) - }) - t.Run("invalid json - fail", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "invalid", - } - require.Error(t, pc.ValidateBasic()) - }) - t.Run("invalid json length - fail", func(t *testing.T) { - pc := types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: testutil.RandomString(types.MaxMetadataJSONFieldLength + 1), - } - require.Error(t, pc.ValidateBasic()) - }) -} - -func TestProviderConfigEqual(t *testing.T) { - cases := []struct { - name string - pc types.ProviderConfig - other types.ProviderConfig - exp bool - }{ - { - name: "equal - basic", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "", - }, - exp: true, - }, - { - name: "equal - inverted with normalize by", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - Invert: true, - Metadata_JSON: "", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - Invert: true, - Metadata_JSON: "", - }, - exp: true, - }, - { - name: "equal - same metadata", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "{data: 1}", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "{data: 1}", - }, - exp: true, - }, - { - name: "different name", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - }, - other: types.ProviderConfig{ - Name: "binance", - OffChainTicker: "ticker", - }, - exp: false, - }, - { - name: "different offchain ticker", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker2", - }, - exp: false, - }, - { - name: "different invert", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Invert: true, - Metadata_JSON: "", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Invert: false, - Metadata_JSON: "", - }, - exp: false, - }, - { - name: "different normalize by", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Invert: true, - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "BASE", - Quote: "QUOTE", - }, - Metadata_JSON: "", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Invert: true, - NormalizeByPair: &slinkytypes.CurrencyPair{ - Base: "QUOTE", - Quote: "QUOTE", - }, - Metadata_JSON: "", - }, - exp: false, - }, - { - name: "different metadata", - pc: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "{data: 1}", - }, - other: types.ProviderConfig{ - Name: "mexc", - OffChainTicker: "ticker", - Metadata_JSON: "", - }, - exp: false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.exp, tc.pc.Equal(tc.other)) - }) - } -} diff --git a/x/mm2/types/query.pb.go b/x/mm2/types/query.pb.go deleted file mode 100644 index 29977fbfe..000000000 --- a/x/mm2/types/query.pb.go +++ /dev/null @@ -1,1682 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/mm2/v1/query.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - types "github.com/skip-mev/slinky/pkg/types" - _ "google.golang.org/genproto/googleapis/api/annotations" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MarketMapRequest is the query request for the MarketMap query. -// It takes no arguments. -type MarketMapRequest struct { -} - -func (m *MarketMapRequest) Reset() { *m = MarketMapRequest{} } -func (m *MarketMapRequest) String() string { return proto.CompactTextString(m) } -func (*MarketMapRequest) ProtoMessage() {} -func (*MarketMapRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{0} -} -func (m *MarketMapRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MarketMapRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MarketMapRequest.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 *MarketMapRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MarketMapRequest.Merge(m, src) -} -func (m *MarketMapRequest) XXX_Size() int { - return m.Size() -} -func (m *MarketMapRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MarketMapRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_MarketMapRequest proto.InternalMessageInfo - -// MarketMapResponse is the query response for the MarketMap query. -type MarketMapResponse struct { - // MarketMap defines the global set of market configurations for all providers - // and markets. - MarketMap MarketMap `protobuf:"bytes,1,opt,name=market_map,json=marketMap,proto3" json:"market_map"` - // LastUpdated is the last block height that the market map was updated. - // This field can be used as an optimization for clients checking if there - // is a new update to the map. - LastUpdated uint64 `protobuf:"varint,2,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` - // ChainId is the chain identifier for the market map. - ChainId string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (m *MarketMapResponse) Reset() { *m = MarketMapResponse{} } -func (m *MarketMapResponse) String() string { return proto.CompactTextString(m) } -func (*MarketMapResponse) ProtoMessage() {} -func (*MarketMapResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{1} -} -func (m *MarketMapResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MarketMapResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MarketMapResponse.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 *MarketMapResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MarketMapResponse.Merge(m, src) -} -func (m *MarketMapResponse) XXX_Size() int { - return m.Size() -} -func (m *MarketMapResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MarketMapResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MarketMapResponse proto.InternalMessageInfo - -func (m *MarketMapResponse) GetMarketMap() MarketMap { - if m != nil { - return m.MarketMap - } - return MarketMap{} -} - -func (m *MarketMapResponse) GetLastUpdated() uint64 { - if m != nil { - return m.LastUpdated - } - return 0 -} - -func (m *MarketMapResponse) GetChainId() string { - if m != nil { - return m.ChainId - } - return "" -} - -// MarketRequest is the query request for the Market query. -// It takes the currency pair of the market as an argument. -type MarketRequest struct { - // CurrencyPair is the currency pair associated with the market being - // requested. - CurrencyPair types.CurrencyPair `protobuf:"bytes,3,opt,name=currency_pair,json=currencyPair,proto3" json:"currency_pair"` -} - -func (m *MarketRequest) Reset() { *m = MarketRequest{} } -func (m *MarketRequest) String() string { return proto.CompactTextString(m) } -func (*MarketRequest) ProtoMessage() {} -func (*MarketRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{2} -} -func (m *MarketRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MarketRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MarketRequest.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 *MarketRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_MarketRequest.Merge(m, src) -} -func (m *MarketRequest) XXX_Size() int { - return m.Size() -} -func (m *MarketRequest) XXX_DiscardUnknown() { - xxx_messageInfo_MarketRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_MarketRequest proto.InternalMessageInfo - -func (m *MarketRequest) GetCurrencyPair() types.CurrencyPair { - if m != nil { - return m.CurrencyPair - } - return types.CurrencyPair{} -} - -// MarketResponse is the query response for the Market query. -type MarketResponse struct { - // Market is the configuration of a single market to be price-fetched for. - Market Market `protobuf:"bytes,1,opt,name=market,proto3" json:"market"` -} - -func (m *MarketResponse) Reset() { *m = MarketResponse{} } -func (m *MarketResponse) String() string { return proto.CompactTextString(m) } -func (*MarketResponse) ProtoMessage() {} -func (*MarketResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{3} -} -func (m *MarketResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MarketResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MarketResponse.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 *MarketResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MarketResponse.Merge(m, src) -} -func (m *MarketResponse) XXX_Size() int { - return m.Size() -} -func (m *MarketResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MarketResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MarketResponse proto.InternalMessageInfo - -func (m *MarketResponse) GetMarket() Market { - if m != nil { - return m.Market - } - return Market{} -} - -// ParamsRequest is the request type for the Query/Params RPC method. -type ParamsRequest struct { -} - -func (m *ParamsRequest) Reset() { *m = ParamsRequest{} } -func (m *ParamsRequest) String() string { return proto.CompactTextString(m) } -func (*ParamsRequest) ProtoMessage() {} -func (*ParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{4} -} -func (m *ParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsRequest.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 *ParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsRequest.Merge(m, src) -} -func (m *ParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *ParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsRequest proto.InternalMessageInfo - -// ParamsResponse is the response type for the Query/Params RPC method. -type ParamsResponse struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *ParamsResponse) Reset() { *m = ParamsResponse{} } -func (m *ParamsResponse) String() string { return proto.CompactTextString(m) } -func (*ParamsResponse) ProtoMessage() {} -func (*ParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{5} -} -func (m *ParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *ParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ParamsResponse.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 *ParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_ParamsResponse.Merge(m, src) -} -func (m *ParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *ParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_ParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_ParamsResponse proto.InternalMessageInfo - -func (m *ParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -// LastUpdatedRequest is the request type for the Query/LastUpdated RPC -// method. -type LastUpdatedRequest struct { -} - -func (m *LastUpdatedRequest) Reset() { *m = LastUpdatedRequest{} } -func (m *LastUpdatedRequest) String() string { return proto.CompactTextString(m) } -func (*LastUpdatedRequest) ProtoMessage() {} -func (*LastUpdatedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{6} -} -func (m *LastUpdatedRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LastUpdatedRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LastUpdatedRequest.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 *LastUpdatedRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_LastUpdatedRequest.Merge(m, src) -} -func (m *LastUpdatedRequest) XXX_Size() int { - return m.Size() -} -func (m *LastUpdatedRequest) XXX_DiscardUnknown() { - xxx_messageInfo_LastUpdatedRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_LastUpdatedRequest proto.InternalMessageInfo - -// LastUpdatedResponse is the response type for the Query/LastUpdated RPC -// method. -type LastUpdatedResponse struct { - LastUpdated uint64 `protobuf:"varint,1,opt,name=last_updated,json=lastUpdated,proto3" json:"last_updated,omitempty"` -} - -func (m *LastUpdatedResponse) Reset() { *m = LastUpdatedResponse{} } -func (m *LastUpdatedResponse) String() string { return proto.CompactTextString(m) } -func (*LastUpdatedResponse) ProtoMessage() {} -func (*LastUpdatedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_a112ce7368e99f97, []int{7} -} -func (m *LastUpdatedResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *LastUpdatedResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_LastUpdatedResponse.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 *LastUpdatedResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_LastUpdatedResponse.Merge(m, src) -} -func (m *LastUpdatedResponse) XXX_Size() int { - return m.Size() -} -func (m *LastUpdatedResponse) XXX_DiscardUnknown() { - xxx_messageInfo_LastUpdatedResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_LastUpdatedResponse proto.InternalMessageInfo - -func (m *LastUpdatedResponse) GetLastUpdated() uint64 { - if m != nil { - return m.LastUpdated - } - return 0 -} - -func init() { - proto.RegisterType((*MarketMapRequest)(nil), "slinky.mm2.v1.MarketMapRequest") - proto.RegisterType((*MarketMapResponse)(nil), "slinky.mm2.v1.MarketMapResponse") - proto.RegisterType((*MarketRequest)(nil), "slinky.mm2.v1.MarketRequest") - proto.RegisterType((*MarketResponse)(nil), "slinky.mm2.v1.MarketResponse") - proto.RegisterType((*ParamsRequest)(nil), "slinky.mm2.v1.ParamsRequest") - proto.RegisterType((*ParamsResponse)(nil), "slinky.mm2.v1.ParamsResponse") - proto.RegisterType((*LastUpdatedRequest)(nil), "slinky.mm2.v1.LastUpdatedRequest") - proto.RegisterType((*LastUpdatedResponse)(nil), "slinky.mm2.v1.LastUpdatedResponse") -} - -func init() { proto.RegisterFile("slinky/mm2/v1/query.proto", fileDescriptor_a112ce7368e99f97) } - -var fileDescriptor_a112ce7368e99f97 = []byte{ - // 539 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0xcd, 0x6e, 0xd3, 0x4c, - 0x14, 0x8d, 0xdb, 0x7e, 0xf9, 0xc8, 0x4d, 0x53, 0x60, 0x68, 0x45, 0x6a, 0x1a, 0x37, 0x75, 0x25, - 0x94, 0x0d, 0xb6, 0xea, 0x6e, 0xd8, 0x20, 0xa1, 0xa2, 0x4a, 0x20, 0x51, 0xa9, 0x44, 0x62, 0x01, - 0x9b, 0x68, 0x6a, 0x8f, 0x5c, 0x2b, 0x19, 0xcf, 0xd4, 0x3f, 0x11, 0xde, 0xf2, 0x04, 0x95, 0x78, - 0x21, 0x96, 0x5d, 0x56, 0x62, 0xc3, 0x0a, 0xa1, 0x84, 0x07, 0x41, 0x9e, 0x19, 0xb7, 0x71, 0x62, - 0xb3, 0xb3, 0xef, 0x3d, 0x73, 0xce, 0x3d, 0x67, 0xee, 0xc0, 0x6e, 0x3c, 0x09, 0xc2, 0x71, 0x66, - 0x53, 0xea, 0xd8, 0xd3, 0x23, 0xfb, 0x2a, 0x25, 0x51, 0x66, 0xf1, 0x88, 0x25, 0x0c, 0x75, 0x64, - 0xcb, 0xa2, 0xd4, 0xb1, 0xa6, 0x47, 0xfa, 0xb6, 0xcf, 0x7c, 0x26, 0x3a, 0x76, 0xfe, 0x25, 0x41, - 0xfa, 0x9e, 0xcf, 0x98, 0x3f, 0x21, 0x36, 0xe6, 0x81, 0x8d, 0xc3, 0x90, 0x25, 0x38, 0x09, 0x58, - 0x18, 0xab, 0xee, 0xa1, 0x62, 0x4f, 0x32, 0x4e, 0xe2, 0x9c, 0xdf, 0x4d, 0xa3, 0x88, 0x84, 0x6e, - 0x36, 0xe2, 0x38, 0x88, 0x14, 0x48, 0x2f, 0x8f, 0x40, 0x71, 0x34, 0x26, 0x49, 0x75, 0x8f, 0xe3, - 0x08, 0x53, 0x45, 0x6e, 0x22, 0x78, 0x74, 0x26, 0xb0, 0x67, 0x98, 0x0f, 0xc9, 0x55, 0x4a, 0xe2, - 0xc4, 0xbc, 0xd6, 0xe0, 0xf1, 0x42, 0x31, 0xe6, 0x2c, 0x8c, 0x09, 0x7a, 0x05, 0x20, 0x59, 0x47, - 0x14, 0xf3, 0xae, 0xd6, 0xd7, 0x06, 0x6d, 0xa7, 0x6b, 0x95, 0xec, 0x59, 0x77, 0xa7, 0x4e, 0x36, - 0x6e, 0x7e, 0xed, 0x37, 0x86, 0x2d, 0x5a, 0x14, 0xd0, 0x01, 0x6c, 0x4e, 0x70, 0x9c, 0x8c, 0x52, - 0xee, 0xe1, 0x84, 0x78, 0xdd, 0xb5, 0xbe, 0x36, 0xd8, 0x18, 0xb6, 0xf3, 0xda, 0x47, 0x59, 0x42, - 0xbb, 0xf0, 0xc0, 0xbd, 0xc4, 0x41, 0x38, 0x0a, 0xbc, 0xee, 0x7a, 0x5f, 0x1b, 0xb4, 0x86, 0xff, - 0x8b, 0xff, 0x77, 0x9e, 0xf9, 0x09, 0x3a, 0x92, 0x5b, 0xcd, 0x88, 0xde, 0x42, 0xa7, 0x14, 0x83, - 0x38, 0xd0, 0x76, 0x7a, 0xc5, 0x40, 0x22, 0xac, 0x7c, 0xa4, 0x37, 0x0a, 0x75, 0x8e, 0x83, 0x48, - 0x4d, 0xb5, 0xe9, 0x2e, 0xd4, 0xcc, 0x53, 0xd8, 0x2a, 0xa8, 0x95, 0xd3, 0x63, 0x68, 0xca, 0xb9, - 0x95, 0xcb, 0x9d, 0x4a, 0x97, 0x8a, 0x4c, 0x41, 0xcd, 0x87, 0xd0, 0x39, 0x17, 0xc1, 0x16, 0x29, - 0x9e, 0xc2, 0x56, 0x51, 0xb8, 0xe7, 0x95, 0xd9, 0xd7, 0xf0, 0x4a, 0x78, 0xc1, 0x2b, 0xa1, 0xe6, - 0x36, 0xa0, 0xf7, 0xf7, 0x19, 0x15, 0xe4, 0x2f, 0xe1, 0x49, 0xa9, 0xaa, 0x14, 0x96, 0x43, 0xd6, - 0x56, 0x42, 0x76, 0xbe, 0xaf, 0xc3, 0x7f, 0x1f, 0xf2, 0x05, 0x45, 0x1c, 0x5a, 0x77, 0xf7, 0x85, - 0xf6, 0xeb, 0x6e, 0x52, 0x29, 0xea, 0xfd, 0x7a, 0x80, 0x14, 0x37, 0xfb, 0x5f, 0x7f, 0xfc, 0xf9, - 0xb6, 0xa6, 0xa3, 0xae, 0x5d, 0xb5, 0x8b, 0x14, 0x73, 0xe4, 0x41, 0x53, 0x1e, 0x43, 0x7b, 0x95, - 0x6c, 0x85, 0x56, 0xaf, 0xa6, 0xab, 0x84, 0x7a, 0x42, 0xe8, 0x29, 0xda, 0xa9, 0x14, 0x42, 0x19, - 0xb4, 0x17, 0xb2, 0x41, 0x07, 0x4b, 0x64, 0xab, 0x69, 0xea, 0xe6, 0xbf, 0x20, 0x4a, 0xf4, 0x50, - 0x88, 0xf6, 0xd0, 0xb3, 0x25, 0xd1, 0xc5, 0xbc, 0x73, 0x83, 0xf2, 0x12, 0x57, 0x0c, 0x96, 0x76, - 0x63, 0xc5, 0x60, 0x79, 0x51, 0x6a, 0x0d, 0xca, 0x95, 0x38, 0x79, 0x7d, 0x33, 0x33, 0xb4, 0xdb, - 0x99, 0xa1, 0xfd, 0x9e, 0x19, 0xda, 0xf5, 0xdc, 0x68, 0xdc, 0xce, 0x8d, 0xc6, 0xcf, 0xb9, 0xd1, - 0xf8, 0xfc, 0xdc, 0x0f, 0x92, 0xcb, 0xf4, 0xc2, 0x72, 0x19, 0xb5, 0xe3, 0x71, 0xc0, 0x5f, 0x50, - 0x32, 0x2d, 0x38, 0xbe, 0x08, 0x16, 0xf1, 0x2e, 0x2e, 0x9a, 0xe2, 0xf1, 0x1f, 0xff, 0x0d, 0x00, - 0x00, 0xff, 0xff, 0x67, 0x15, 0x9f, 0x3d, 0xb9, 0x04, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// QueryClient is the client API for Query service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type QueryClient interface { - // MarketMap returns the full market map stored in the x/marketmap - // module. - MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) - // Market returns a market stored in the x/marketmap - // module. - Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) - // LastUpdated returns the last height the market map was updated at. - LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) - // Params returns the current x/marketmap module parameters. - Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) -} - -type queryClient struct { - cc grpc1.ClientConn -} - -func NewQueryClient(cc grpc1.ClientConn) QueryClient { - return &queryClient{cc} -} - -func (c *queryClient) MarketMap(ctx context.Context, in *MarketMapRequest, opts ...grpc.CallOption) (*MarketMapResponse, error) { - out := new(MarketMapResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Query/MarketMap", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Market(ctx context.Context, in *MarketRequest, opts ...grpc.CallOption) (*MarketResponse, error) { - out := new(MarketResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Query/Market", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) LastUpdated(ctx context.Context, in *LastUpdatedRequest, opts ...grpc.CallOption) (*LastUpdatedResponse, error) { - out := new(LastUpdatedResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Query/LastUpdated", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *ParamsRequest, opts ...grpc.CallOption) (*ParamsResponse, error) { - out := new(ParamsResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// QueryServer is the server API for Query service. -type QueryServer interface { - // MarketMap returns the full market map stored in the x/marketmap - // module. - MarketMap(context.Context, *MarketMapRequest) (*MarketMapResponse, error) - // Market returns a market stored in the x/marketmap - // module. - Market(context.Context, *MarketRequest) (*MarketResponse, error) - // LastUpdated returns the last height the market map was updated at. - LastUpdated(context.Context, *LastUpdatedRequest) (*LastUpdatedResponse, error) - // Params returns the current x/marketmap module parameters. - Params(context.Context, *ParamsRequest) (*ParamsResponse, error) -} - -// UnimplementedQueryServer can be embedded to have forward compatible implementations. -type UnimplementedQueryServer struct { -} - -func (*UnimplementedQueryServer) MarketMap(ctx context.Context, req *MarketMapRequest) (*MarketMapResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method MarketMap not implemented") -} -func (*UnimplementedQueryServer) Market(ctx context.Context, req *MarketRequest) (*MarketResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Market not implemented") -} -func (*UnimplementedQueryServer) LastUpdated(ctx context.Context, req *LastUpdatedRequest) (*LastUpdatedResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method LastUpdated not implemented") -} -func (*UnimplementedQueryServer) Params(ctx context.Context, req *ParamsRequest) (*ParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} - -func RegisterQueryServer(s grpc1.Server, srv QueryServer) { - s.RegisterService(&_Query_serviceDesc, srv) -} - -func _Query_MarketMap_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MarketMapRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).MarketMap(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Query/MarketMap", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).MarketMap(ctx, req.(*MarketMapRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Market_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MarketRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Market(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Query/Market", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Market(ctx, req.(*MarketRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_LastUpdated_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(LastUpdatedRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).LastUpdated(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Query/LastUpdated", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).LastUpdated(ctx, req.(*LastUpdatedRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(ParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*ParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Query_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.mm2.v1.Query", - HandlerType: (*QueryServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "MarketMap", - Handler: _Query_MarketMap_Handler, - }, - { - MethodName: "Market", - Handler: _Query_Market_Handler, - }, - { - MethodName: "LastUpdated", - Handler: _Query_LastUpdated_Handler, - }, - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/mm2/v1/query.proto", -} - -func (m *MarketMapRequest) 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 *MarketMapRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MarketMapRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MarketMapResponse) 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 *MarketMapResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MarketMapResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ChainId) > 0 { - i -= len(m.ChainId) - copy(dAtA[i:], m.ChainId) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ChainId))) - i-- - dAtA[i] = 0x1a - } - if m.LastUpdated != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.LastUpdated)) - i-- - dAtA[i] = 0x10 - } - { - size, err := m.MarketMap.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MarketRequest) 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 *MarketRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MarketRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.CurrencyPair.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x1a - return len(dAtA) - i, nil -} - -func (m *MarketResponse) 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 *MarketResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MarketResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Market.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *ParamsRequest) 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 *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *ParamsResponse) 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 *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *LastUpdatedRequest) 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 *LastUpdatedRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LastUpdatedRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *LastUpdatedResponse) 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 *LastUpdatedResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *LastUpdatedResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.LastUpdated != 0 { - i = encodeVarintQuery(dAtA, i, uint64(m.LastUpdated)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MarketMapRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MarketMapResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.MarketMap.Size() - n += 1 + l + sovQuery(uint64(l)) - if m.LastUpdated != 0 { - n += 1 + sovQuery(uint64(m.LastUpdated)) - } - l = len(m.ChainId) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *MarketRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.CurrencyPair.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *MarketResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Market.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *ParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *ParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *LastUpdatedRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *LastUpdatedResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LastUpdated != 0 { - n += 1 + sovQuery(uint64(m.LastUpdated)) - } - return n -} - -func sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MarketMapRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MarketMapRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MarketMapRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MarketMapResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MarketMapResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MarketMapResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field MarketMap", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.MarketMap.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - m.LastUpdated = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastUpdated |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ChainId = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MarketRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MarketRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MarketRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CurrencyPair", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.CurrencyPair.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MarketResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: MarketResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MarketResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Market", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Market.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *ParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: ParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LastUpdatedRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LastUpdatedRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LastUpdatedRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *LastUpdatedResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: LastUpdatedResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: LastUpdatedResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LastUpdated", wireType) - } - m.LastUpdated = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LastUpdated |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipQuery(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowQuery - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthQuery - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupQuery - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthQuery - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthQuery = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowQuery = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupQuery = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/mm2/types/query.pb.gw.go b/x/mm2/types/query.pb.gw.go deleted file mode 100644 index 9dd204916..000000000 --- a/x/mm2/types/query.pb.gw.go +++ /dev/null @@ -1,366 +0,0 @@ -// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. -// source: slinky/mm2/v1/query.proto - -/* -Package types is a reverse proxy. - -It translates gRPC into RESTful JSON APIs. -*/ -package types - -import ( - "context" - "io" - "net/http" - - "github.com/golang/protobuf/descriptor" - "github.com/golang/protobuf/proto" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/grpc-ecosystem/grpc-gateway/utilities" - "google.golang.org/grpc" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -// Suppress "imported and not used" errors -var _ codes.Code -var _ io.Reader -var _ status.Status -var _ = runtime.String -var _ = utilities.NewDoubleArray -var _ = descriptor.ForMessage -var _ = metadata.Join - -func request_Query_MarketMap_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MarketMapRequest - var metadata runtime.ServerMetadata - - msg, err := client.MarketMap(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_MarketMap_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MarketMapRequest - var metadata runtime.ServerMetadata - - msg, err := server.MarketMap(ctx, &protoReq) - return msg, metadata, err - -} - -var ( - filter_Query_Market_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} -) - -func request_Query_Market_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MarketRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Market_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := client.Market(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Market_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq MarketRequest - var metadata runtime.ServerMetadata - - if err := req.ParseForm(); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_Query_Market_0); err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) - } - - msg, err := server.Market(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_LastUpdated_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LastUpdatedRequest - var metadata runtime.ServerMetadata - - msg, err := client.LastUpdated(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_LastUpdated_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq LastUpdatedRequest - var metadata runtime.ServerMetadata - - msg, err := server.LastUpdated(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq ParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - -// RegisterQueryHandlerServer registers the http handlers for service Query to "mux". -// UnaryRPC :call QueryServer directly. -// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. -func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - - mux.Handle("GET", pattern_Query_MarketMap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_MarketMap_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_MarketMap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Market_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Market_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Market_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LastUpdated_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_LastUpdated_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_LastUpdated_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -// RegisterQueryHandlerFromEndpoint is same as RegisterQueryHandler but -// automatically dials to "endpoint" and closes the connection when "ctx" gets done. -func RegisterQueryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { - conn, err := grpc.Dial(endpoint, opts...) - if err != nil { - return err - } - defer func() { - if err != nil { - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - return - } - go func() { - <-ctx.Done() - if cerr := conn.Close(); cerr != nil { - grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) - } - }() - }() - - return RegisterQueryHandler(ctx, mux, conn) -} - -// RegisterQueryHandler registers the http handlers for service Query to "mux". -// The handlers forward requests to the grpc endpoint over "conn". -func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { - return RegisterQueryHandlerClient(ctx, mux, NewQueryClient(conn)) -} - -// RegisterQueryHandlerClient registers the http handlers for service Query -// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "QueryClient". -// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "QueryClient" -// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in -// "QueryClient" to call the correct interceptors. -func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - - mux.Handle("GET", pattern_Query_MarketMap_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_MarketMap_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_MarketMap_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Market_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Market_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Market_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_LastUpdated_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_LastUpdated_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_LastUpdated_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - return nil -} - -var ( - pattern_Query_MarketMap_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "mm2", "v1", "marketmap"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Market_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "mm2", "v1", "market"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_LastUpdated_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "mm2", "v1", "last_updated"}, "", runtime.AssumeColonVerbOpt(false))) - - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 2, 3}, []string{"slinky", "mm2", "v1", "params"}, "", runtime.AssumeColonVerbOpt(false))) -) - -var ( - forward_Query_MarketMap_0 = runtime.ForwardResponseMessage - - forward_Query_Market_0 = runtime.ForwardResponseMessage - - forward_Query_LastUpdated_0 = runtime.ForwardResponseMessage - - forward_Query_Params_0 = runtime.ForwardResponseMessage -) diff --git a/x/mm2/types/ticker.go b/x/mm2/types/ticker.go deleted file mode 100644 index f3cfcf64a..000000000 --- a/x/mm2/types/ticker.go +++ /dev/null @@ -1,72 +0,0 @@ -package types - -import ( - "fmt" - "strings" - - "github.com/skip-mev/slinky/pkg/json" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" -) - -const ( - // DefaultMaxDecimals is the maximum number of decimals allowed for a ticker. - DefaultMaxDecimals = 36 - // DefaultMinProviderCount is the minimum number of providers required for a - // ticker to be considered valid. - DefaultMinProviderCount = 1 - // MaxMetadataJSONFieldLength is the maximum length of the MetadataJSON field. - MaxMetadataJSONFieldLength = 16384 -) - -// NewTicker returns a new Ticker instance. A Ticker represents a price feed for -// a given asset pair i.e. BTC/USD. The price feed is scaled to a number of decimal -// places and has a minimum number of providers required to consider the ticker valid. -func NewTicker(base, quote string, decimals, minProviderCount uint64) Ticker { - return Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: strings.ToUpper(base), - Quote: strings.ToUpper(quote), - }, - Decimals: decimals, - MinProviderCount: minProviderCount, - } -} - -// String returns a string representation of the Ticker. -func (t Ticker) String() string { - return t.CurrencyPair.String() -} - -// ValidateBasic performs basic validation on the Ticker. -func (t *Ticker) ValidateBasic() error { - if t.Decimals > DefaultMaxDecimals || t.Decimals == 0 { - return fmt.Errorf("decimals must be between 1 and %d; got %d for %s", DefaultMaxDecimals, t.Decimals, t.CurrencyPair.String()) - } - if t.MinProviderCount < DefaultMinProviderCount { - return fmt.Errorf("min provider count must be at least %d; got %d for %s", DefaultMinProviderCount, t.MinProviderCount, t.CurrencyPair.String()) - } - - if err := t.CurrencyPair.ValidateBasic(); err != nil { - return err - } - - if len(t.Metadata_JSON) > MaxMetadataJSONFieldLength { - return fmt.Errorf("metadata json field is longer than maximum length of %d", MaxMetadataJSONFieldLength) - } - - if err := json.IsValid([]byte(t.Metadata_JSON)); err != nil { - return fmt.Errorf("invalid ticker metadata json: %w", err) - } - - return nil -} - -// Equal returns true iff the Ticker is equal to the given Ticker. -func (t *Ticker) Equal(other Ticker) bool { - return t.CurrencyPair.Equal(other.CurrencyPair) && - t.Decimals == other.Decimals && - t.MinProviderCount == other.MinProviderCount && - t.Metadata_JSON == other.Metadata_JSON && - t.Enabled == other.Enabled -} diff --git a/x/mm2/types/ticker_test.go b/x/mm2/types/ticker_test.go deleted file mode 100644 index 8e79d902a..000000000 --- a/x/mm2/types/ticker_test.go +++ /dev/null @@ -1,312 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/skip-mev/slinky/testutil" - - "github.com/stretchr/testify/require" - - slinkytypes "github.com/skip-mev/slinky/pkg/types" - "github.com/skip-mev/slinky/x/mm2/types" -) - -func TestTicker(t *testing.T) { - testCases := []struct { - name string - ticker types.Ticker - expErr bool - }{ - { - name: "valid ticker", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: "", - }, - expErr: false, - }, - { - name: "empty base", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: "", - }, - expErr: true, - }, - { - name: "empty quote", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: "", - }, - expErr: true, - }, - { - name: "invalid base", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "bitcoin", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: "", - }, - expErr: true, - }, - { - name: "invalid quote", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "usdt", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: "", - }, - expErr: true, - }, - { - name: "invalid decimals", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 0, - MinProviderCount: 1, - Metadata_JSON: "", - }, - expErr: true, - }, - { - name: "invalid min provider count", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 0, - Metadata_JSON: "", - }, - expErr: true, - }, - { - name: "invalid json len", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 0, - Metadata_JSON: testutil.RandomString(types.MaxMetadataJSONFieldLength + 1), - }, - expErr: true, - }, - { - name: "invalid json", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 0, - Metadata_JSON: "invalid", - }, - expErr: true, - }, - } - - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { - err := tc.ticker.ValidateBasic() - if tc.expErr { - require.Error(t, err) - return - } - - require.NoError(t, err) - }) - } -} - -func TestTickerEqual(t *testing.T) { - cases := []struct { - name string - ticker types.Ticker - other types.Ticker - exp bool - }{ - { - name: "equal tickers", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - exp: true, - }, - { - name: "different base", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "ETHEREUM", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - exp: false, - }, - { - name: "different quote", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "BTC", - }, - Decimals: 8, - MinProviderCount: 1, - }, - exp: false, - }, - { - name: "different decimals", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 18, - MinProviderCount: 1, - }, - exp: false, - }, - { - name: "different min provider count", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 2, - }, - exp: false, - }, - - { - name: "different metadata", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: `{"key": "value"}`, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Metadata_JSON: `{"key": "value2"}`, - }, - exp: false, - }, - - { - name: "different enabled", - ticker: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Enabled: true, - }, - other: types.Ticker{ - CurrencyPair: slinkytypes.CurrencyPair{ - Base: "BITCOIN", - Quote: "USDT", - }, - Decimals: 8, - MinProviderCount: 1, - Enabled: false, - }, - exp: false, - }, - } - - for _, tc := range cases { - t.Run(tc.name, func(t *testing.T) { - require.Equal(t, tc.ticker.Equal(tc.other), tc.exp) - }) - } -} diff --git a/x/mm2/types/tx.pb.go b/x/mm2/types/tx.pb.go deleted file mode 100644 index 0bff8ced9..000000000 --- a/x/mm2/types/tx.pb.go +++ /dev/null @@ -1,1792 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: slinky/mm2/v1/tx.proto - -package types - -import ( - context "context" - fmt "fmt" - _ "github.com/cosmos/cosmos-proto" - _ "github.com/cosmos/cosmos-sdk/types/msgservice" - _ "github.com/cosmos/cosmos-sdk/types/tx/amino" - _ "github.com/cosmos/gogoproto/gogoproto" - grpc1 "github.com/cosmos/gogoproto/grpc" - proto "github.com/cosmos/gogoproto/proto" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -// MsgCreateMarkets defines a message carrying a payload for creating markets in -// the x/marketmap module. -type MsgCreateMarkets struct { - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // CreateMarkets is the list of all markets to be created for the given - // transaction. - CreateMarkets []Market `protobuf:"bytes,2,rep,name=create_markets,json=createMarkets,proto3" json:"create_markets"` -} - -func (m *MsgCreateMarkets) Reset() { *m = MsgCreateMarkets{} } -func (m *MsgCreateMarkets) String() string { return proto.CompactTextString(m) } -func (*MsgCreateMarkets) ProtoMessage() {} -func (*MsgCreateMarkets) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{0} -} -func (m *MsgCreateMarkets) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateMarkets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateMarkets.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 *MsgCreateMarkets) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateMarkets.Merge(m, src) -} -func (m *MsgCreateMarkets) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateMarkets) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateMarkets.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateMarkets proto.InternalMessageInfo - -func (m *MsgCreateMarkets) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgCreateMarkets) GetCreateMarkets() []Market { - if m != nil { - return m.CreateMarkets - } - return nil -} - -// MsgUpdateMarketMapResponse is the response message for MsgUpdateMarketMap. -type MsgCreateMarketsResponse struct { -} - -func (m *MsgCreateMarketsResponse) Reset() { *m = MsgCreateMarketsResponse{} } -func (m *MsgCreateMarketsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgCreateMarketsResponse) ProtoMessage() {} -func (*MsgCreateMarketsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{1} -} -func (m *MsgCreateMarketsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgCreateMarketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgCreateMarketsResponse.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 *MsgCreateMarketsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgCreateMarketsResponse.Merge(m, src) -} -func (m *MsgCreateMarketsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgCreateMarketsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgCreateMarketsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgCreateMarketsResponse proto.InternalMessageInfo - -// MsgUpdateMarkets defines a message carrying a payload for updating the -// x/marketmap module. -type MsgUpdateMarkets struct { - // Authority is the signer of this transaction. This authority must be - // authorized by the module to execute the message. - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - // UpdateMarkets is the list of all markets to be updated for the given - // transaction. - UpdateMarkets []Market `protobuf:"bytes,2,rep,name=update_markets,json=updateMarkets,proto3" json:"update_markets"` -} - -func (m *MsgUpdateMarkets) Reset() { *m = MsgUpdateMarkets{} } -func (m *MsgUpdateMarkets) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateMarkets) ProtoMessage() {} -func (*MsgUpdateMarkets) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{2} -} -func (m *MsgUpdateMarkets) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateMarkets) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateMarkets.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 *MsgUpdateMarkets) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateMarkets.Merge(m, src) -} -func (m *MsgUpdateMarkets) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateMarkets) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateMarkets.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateMarkets proto.InternalMessageInfo - -func (m *MsgUpdateMarkets) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -func (m *MsgUpdateMarkets) GetUpdateMarkets() []Market { - if m != nil { - return m.UpdateMarkets - } - return nil -} - -// MsgUpdateMarketsResponse is the response message for MsgUpdateMarkets. -type MsgUpdateMarketsResponse struct { -} - -func (m *MsgUpdateMarketsResponse) Reset() { *m = MsgUpdateMarketsResponse{} } -func (m *MsgUpdateMarketsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgUpdateMarketsResponse) ProtoMessage() {} -func (*MsgUpdateMarketsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{3} -} -func (m *MsgUpdateMarketsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgUpdateMarketsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgUpdateMarketsResponse.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 *MsgUpdateMarketsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgUpdateMarketsResponse.Merge(m, src) -} -func (m *MsgUpdateMarketsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgUpdateMarketsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgUpdateMarketsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgUpdateMarketsResponse proto.InternalMessageInfo - -// MsgParams defines the Msg/Params request type. It contains the -// new parameters for the x/marketmap module. -type MsgParams struct { - // Params defines the new parameters for the x/marketmap module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - // Authority defines the authority that is updating the x/marketmap module - // parameters. - Authority string `protobuf:"bytes,2,opt,name=authority,proto3" json:"authority,omitempty"` -} - -func (m *MsgParams) Reset() { *m = MsgParams{} } -func (m *MsgParams) String() string { return proto.CompactTextString(m) } -func (*MsgParams) ProtoMessage() {} -func (*MsgParams) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{4} -} -func (m *MsgParams) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgParams.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 *MsgParams) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgParams.Merge(m, src) -} -func (m *MsgParams) XXX_Size() int { - return m.Size() -} -func (m *MsgParams) XXX_DiscardUnknown() { - xxx_messageInfo_MsgParams.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgParams proto.InternalMessageInfo - -func (m *MsgParams) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - -func (m *MsgParams) GetAuthority() string { - if m != nil { - return m.Authority - } - return "" -} - -// MsgParamsResponse defines the Msg/Params response type. -type MsgParamsResponse struct { -} - -func (m *MsgParamsResponse) Reset() { *m = MsgParamsResponse{} } -func (m *MsgParamsResponse) String() string { return proto.CompactTextString(m) } -func (*MsgParamsResponse) ProtoMessage() {} -func (*MsgParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{5} -} -func (m *MsgParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgParamsResponse.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 *MsgParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgParamsResponse.Merge(m, src) -} -func (m *MsgParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgParamsResponse proto.InternalMessageInfo - -// MsgRemoveMarketAuthorities defines the Msg/RemoveMarketAuthoritiesResponse -// request type. It contains the new addresses to remove from the list of -// authorities -type MsgRemoveMarketAuthorities struct { - // RemoveAddresses is the list of addresses to remove. - RemoveAddresses []string `protobuf:"bytes,1,rep,name=remove_addresses,json=removeAddresses,proto3" json:"remove_addresses,omitempty"` - // Admin defines the authority that is the x/marketmap - // Admin account. This account is set in the module parameters. - Admin string `protobuf:"bytes,2,opt,name=admin,proto3" json:"admin,omitempty"` -} - -func (m *MsgRemoveMarketAuthorities) Reset() { *m = MsgRemoveMarketAuthorities{} } -func (m *MsgRemoveMarketAuthorities) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveMarketAuthorities) ProtoMessage() {} -func (*MsgRemoveMarketAuthorities) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{6} -} -func (m *MsgRemoveMarketAuthorities) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveMarketAuthorities) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveMarketAuthorities.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 *MsgRemoveMarketAuthorities) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveMarketAuthorities.Merge(m, src) -} -func (m *MsgRemoveMarketAuthorities) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveMarketAuthorities) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveMarketAuthorities.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveMarketAuthorities proto.InternalMessageInfo - -func (m *MsgRemoveMarketAuthorities) GetRemoveAddresses() []string { - if m != nil { - return m.RemoveAddresses - } - return nil -} - -func (m *MsgRemoveMarketAuthorities) GetAdmin() string { - if m != nil { - return m.Admin - } - return "" -} - -// MsgRemoveMarketAuthoritiesResponse defines the -// Msg/RemoveMarketAuthoritiesResponse response type. -type MsgRemoveMarketAuthoritiesResponse struct { -} - -func (m *MsgRemoveMarketAuthoritiesResponse) Reset() { *m = MsgRemoveMarketAuthoritiesResponse{} } -func (m *MsgRemoveMarketAuthoritiesResponse) String() string { return proto.CompactTextString(m) } -func (*MsgRemoveMarketAuthoritiesResponse) ProtoMessage() {} -func (*MsgRemoveMarketAuthoritiesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_1a86eaac7c34565b, []int{7} -} -func (m *MsgRemoveMarketAuthoritiesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *MsgRemoveMarketAuthoritiesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse.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 *MsgRemoveMarketAuthoritiesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse.Merge(m, src) -} -func (m *MsgRemoveMarketAuthoritiesResponse) XXX_Size() int { - return m.Size() -} -func (m *MsgRemoveMarketAuthoritiesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_MsgRemoveMarketAuthoritiesResponse proto.InternalMessageInfo - -func init() { - proto.RegisterType((*MsgCreateMarkets)(nil), "slinky.mm2.v1.MsgCreateMarkets") - proto.RegisterType((*MsgCreateMarketsResponse)(nil), "slinky.mm2.v1.MsgCreateMarketsResponse") - proto.RegisterType((*MsgUpdateMarkets)(nil), "slinky.mm2.v1.MsgUpdateMarkets") - proto.RegisterType((*MsgUpdateMarketsResponse)(nil), "slinky.mm2.v1.MsgUpdateMarketsResponse") - proto.RegisterType((*MsgParams)(nil), "slinky.mm2.v1.MsgParams") - proto.RegisterType((*MsgParamsResponse)(nil), "slinky.mm2.v1.MsgParamsResponse") - proto.RegisterType((*MsgRemoveMarketAuthorities)(nil), "slinky.mm2.v1.MsgRemoveMarketAuthorities") - proto.RegisterType((*MsgRemoveMarketAuthoritiesResponse)(nil), "slinky.mm2.v1.MsgRemoveMarketAuthoritiesResponse") -} - -func init() { proto.RegisterFile("slinky/mm2/v1/tx.proto", fileDescriptor_1a86eaac7c34565b) } - -var fileDescriptor_1a86eaac7c34565b = []byte{ - // 558 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xd3, 0x40, - 0x10, 0xb6, 0x1b, 0x1a, 0x29, 0x8b, 0x52, 0x5a, 0x53, 0xa8, 0xf1, 0xc1, 0x89, 0x0c, 0x82, 0x10, - 0xa9, 0x5e, 0xc5, 0x95, 0x38, 0xe4, 0x44, 0x02, 0x57, 0x4b, 0xc8, 0x88, 0x03, 0x5c, 0x22, 0x37, - 0x59, 0x6d, 0xad, 0xb0, 0x5e, 0xcb, 0xeb, 0x84, 0xe6, 0xc6, 0xcf, 0x05, 0x71, 0xe2, 0x11, 0x78, - 0x84, 0x1c, 0x78, 0x88, 0x8a, 0x53, 0xc5, 0x89, 0x13, 0x42, 0xc9, 0x21, 0x3c, 0x06, 0xb2, 0x77, - 0x9d, 0x74, 0xf3, 0xa3, 0xb6, 0x12, 0x97, 0x68, 0x33, 0xf3, 0xcd, 0x37, 0xdf, 0xb7, 0x33, 0x6b, - 0x70, 0x97, 0xbd, 0x0d, 0xc2, 0xfe, 0x08, 0x12, 0xe2, 0xc0, 0x61, 0x03, 0x26, 0xa7, 0x76, 0x14, - 0xd3, 0x84, 0x6a, 0x65, 0x1e, 0xb7, 0x09, 0x71, 0xec, 0x61, 0xc3, 0x38, 0xe8, 0x52, 0x46, 0x28, - 0x83, 0x84, 0xe1, 0x14, 0x46, 0x18, 0xe6, 0x38, 0x63, 0x1f, 0x53, 0x4c, 0xb3, 0x23, 0x4c, 0x4f, - 0x22, 0x7a, 0x8f, 0xc3, 0x3b, 0x3c, 0xc1, 0xff, 0x88, 0xd4, 0x9e, 0x4f, 0x82, 0x90, 0xc2, 0xec, - 0x57, 0x84, 0x0c, 0x59, 0x03, 0xf1, 0xe3, 0x3e, 0x4a, 0xd6, 0xe7, 0x22, 0x3f, 0xf6, 0x89, 0xa0, - 0xb2, 0x7e, 0xa8, 0x60, 0xd7, 0x65, 0xf8, 0x59, 0x8c, 0xfc, 0x04, 0xb9, 0x59, 0x15, 0xd3, 0x9e, - 0x80, 0x92, 0x3f, 0x48, 0x4e, 0x68, 0x1c, 0x24, 0x23, 0x5d, 0xad, 0xaa, 0xb5, 0x52, 0x5b, 0xff, - 0xf9, 0xfd, 0x70, 0x5f, 0x88, 0x68, 0xf5, 0x7a, 0x31, 0x62, 0xec, 0x65, 0x12, 0x07, 0x21, 0xf6, - 0x16, 0x50, 0xad, 0x0d, 0x76, 0xba, 0x19, 0x51, 0x87, 0xf7, 0x67, 0xfa, 0x56, 0xb5, 0x50, 0xbb, - 0xe9, 0xdc, 0xb1, 0xa5, 0x9b, 0xb0, 0x79, 0x9f, 0xf6, 0x8d, 0xb3, 0xdf, 0x15, 0xc5, 0x2b, 0x77, - 0x2f, 0xf6, 0x6e, 0x36, 0xff, 0x7e, 0xab, 0x28, 0x1f, 0x67, 0xe3, 0xfa, 0x82, 0xf7, 0xcb, 0x6c, - 0x5c, 0xbf, 0x2f, 0x3c, 0x9c, 0x0a, 0x6b, 0xc4, 0x8f, 0xe0, 0xb2, 0x6e, 0xcb, 0x00, 0xfa, 0x72, - 0xcc, 0x43, 0x2c, 0xa2, 0x21, 0x43, 0xb9, 0xd1, 0x57, 0x51, 0xef, 0xff, 0x18, 0x1d, 0x64, 0x44, - 0xd7, 0x32, 0x3a, 0xb8, 0xd8, 0xfb, 0x9a, 0x46, 0x25, 0xdd, 0xc2, 0xa8, 0x14, 0x9b, 0x1b, 0xfd, - 0xac, 0x82, 0x92, 0xcb, 0xf0, 0x8b, 0x6c, 0xca, 0xda, 0x11, 0x28, 0xf2, 0x79, 0x67, 0xf6, 0x56, - 0x15, 0x72, 0x98, 0x50, 0x28, 0xa0, 0xf2, 0xb5, 0x6c, 0x5d, 0xf9, 0x5a, 0x9a, 0x3b, 0xb2, 0x1d, - 0xeb, 0x36, 0xd8, 0x9b, 0x2b, 0x99, 0xeb, 0xfb, 0xa4, 0x02, 0xc3, 0x65, 0xd8, 0x43, 0x84, 0x0e, - 0x85, 0xf8, 0x96, 0xa8, 0x08, 0x10, 0xd3, 0x1e, 0x83, 0xdd, 0x38, 0x4b, 0x75, 0x7c, 0xde, 0x06, - 0xa5, 0xd2, 0x0b, 0xb5, 0x92, 0x77, 0x8b, 0xc7, 0x5b, 0x79, 0x58, 0xb3, 0xc1, 0xb6, 0xdf, 0x23, - 0x41, 0x78, 0xa9, 0x44, 0x0e, 0x6b, 0x82, 0x54, 0x1e, 0x3f, 0x5b, 0x0f, 0x80, 0xb5, 0x59, 0x44, - 0xae, 0xd5, 0xf9, 0x50, 0x00, 0x05, 0x97, 0x61, 0xed, 0x35, 0x28, 0xcb, 0x2f, 0xa4, 0xb2, 0x3c, - 0xe8, 0xa5, 0xb5, 0x33, 0x1e, 0x5d, 0x02, 0xc8, 0x5b, 0xa4, 0xd4, 0xf2, 0x4e, 0xae, 0xa1, 0x96, - 0x00, 0xeb, 0xa8, 0xd7, 0x6e, 0x82, 0xf6, 0x1c, 0x14, 0xc5, 0x16, 0xe8, 0xab, 0x25, 0x3c, 0x63, - 0x54, 0x37, 0x65, 0xe6, 0x2c, 0xef, 0xc0, 0xc1, 0xc6, 0x59, 0xad, 0x16, 0x6f, 0x80, 0x1a, 0x8d, - 0x2b, 0x43, 0xf3, 0xc6, 0xc6, 0xf6, 0xfb, 0xd9, 0xb8, 0xae, 0xb6, 0x9f, 0x9e, 0x4d, 0x4c, 0xf5, - 0x7c, 0x62, 0xaa, 0x7f, 0x26, 0xa6, 0xfa, 0x75, 0x6a, 0x2a, 0xe7, 0x53, 0x53, 0xf9, 0x35, 0x35, - 0x95, 0x37, 0x0f, 0x71, 0x90, 0x9c, 0x0c, 0x8e, 0xed, 0x2e, 0x25, 0x90, 0xf5, 0x83, 0xe8, 0x90, - 0xa0, 0x21, 0x5c, 0x3c, 0x1f, 0xe2, 0xc0, 0x64, 0x14, 0x21, 0x76, 0x5c, 0xcc, 0x3e, 0x75, 0x47, - 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x68, 0xff, 0x08, 0xa8, 0x05, 0x00, 0x00, -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// MsgClient is the client API for Msg service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. -type MsgClient interface { - // CreateMarkets creates markets from the given message. - CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) - // UpdateMarkets updates markets from the given message. - UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) - // Params defines a method for updating the x/marketmap module parameters. - Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) - // RemoveMarketAuthorities defines a method for removing market authorities - // from the x/marketmap module. the signer must be the admin. - RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) -} - -type msgClient struct { - cc grpc1.ClientConn -} - -func NewMsgClient(cc grpc1.ClientConn) MsgClient { - return &msgClient{cc} -} - -func (c *msgClient) CreateMarkets(ctx context.Context, in *MsgCreateMarkets, opts ...grpc.CallOption) (*MsgCreateMarketsResponse, error) { - out := new(MsgCreateMarketsResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Msg/CreateMarkets", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) UpdateMarkets(ctx context.Context, in *MsgUpdateMarkets, opts ...grpc.CallOption) (*MsgUpdateMarketsResponse, error) { - out := new(MsgUpdateMarketsResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Msg/UpdateMarkets", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) Params(ctx context.Context, in *MsgParams, opts ...grpc.CallOption) (*MsgParamsResponse, error) { - out := new(MsgParamsResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Msg/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *msgClient) RemoveMarketAuthorities(ctx context.Context, in *MsgRemoveMarketAuthorities, opts ...grpc.CallOption) (*MsgRemoveMarketAuthoritiesResponse, error) { - out := new(MsgRemoveMarketAuthoritiesResponse) - err := c.cc.Invoke(ctx, "/slinky.mm2.v1.Msg/RemoveMarketAuthorities", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// MsgServer is the server API for Msg service. -type MsgServer interface { - // CreateMarkets creates markets from the given message. - CreateMarkets(context.Context, *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) - // UpdateMarkets updates markets from the given message. - UpdateMarkets(context.Context, *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) - // Params defines a method for updating the x/marketmap module parameters. - Params(context.Context, *MsgParams) (*MsgParamsResponse, error) - // RemoveMarketAuthorities defines a method for removing market authorities - // from the x/marketmap module. the signer must be the admin. - RemoveMarketAuthorities(context.Context, *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) -} - -// UnimplementedMsgServer can be embedded to have forward compatible implementations. -type UnimplementedMsgServer struct { -} - -func (*UnimplementedMsgServer) CreateMarkets(ctx context.Context, req *MsgCreateMarkets) (*MsgCreateMarketsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method CreateMarkets not implemented") -} -func (*UnimplementedMsgServer) UpdateMarkets(ctx context.Context, req *MsgUpdateMarkets) (*MsgUpdateMarketsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method UpdateMarkets not implemented") -} -func (*UnimplementedMsgServer) Params(ctx context.Context, req *MsgParams) (*MsgParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} -func (*UnimplementedMsgServer) RemoveMarketAuthorities(ctx context.Context, req *MsgRemoveMarketAuthorities) (*MsgRemoveMarketAuthoritiesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method RemoveMarketAuthorities not implemented") -} - -func RegisterMsgServer(s grpc1.Server, srv MsgServer) { - s.RegisterService(&_Msg_serviceDesc, srv) -} - -func _Msg_CreateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgCreateMarkets) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).CreateMarkets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Msg/CreateMarkets", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).CreateMarkets(ctx, req.(*MsgCreateMarkets)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_UpdateMarkets_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgUpdateMarkets) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).UpdateMarkets(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Msg/UpdateMarkets", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).UpdateMarkets(ctx, req.(*MsgUpdateMarkets)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgParams) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Msg/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).Params(ctx, req.(*MsgParams)) - } - return interceptor(ctx, in, info, handler) -} - -func _Msg_RemoveMarketAuthorities_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgRemoveMarketAuthorities) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(MsgServer).RemoveMarketAuthorities(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/slinky.mm2.v1.Msg/RemoveMarketAuthorities", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).RemoveMarketAuthorities(ctx, req.(*MsgRemoveMarketAuthorities)) - } - return interceptor(ctx, in, info, handler) -} - -var _Msg_serviceDesc = grpc.ServiceDesc{ - ServiceName: "slinky.mm2.v1.Msg", - HandlerType: (*MsgServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "CreateMarkets", - Handler: _Msg_CreateMarkets_Handler, - }, - { - MethodName: "UpdateMarkets", - Handler: _Msg_UpdateMarkets_Handler, - }, - { - MethodName: "Params", - Handler: _Msg_Params_Handler, - }, - { - MethodName: "RemoveMarketAuthorities", - Handler: _Msg_RemoveMarketAuthorities_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "slinky/mm2/v1/tx.proto", -} - -func (m *MsgCreateMarkets) 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 *MsgCreateMarkets) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateMarkets) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.CreateMarkets) > 0 { - for iNdEx := len(m.CreateMarkets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CreateMarkets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgCreateMarketsResponse) 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 *MsgCreateMarketsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgCreateMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgUpdateMarkets) 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 *MsgUpdateMarkets) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateMarkets) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.UpdateMarkets) > 0 { - for iNdEx := len(m.UpdateMarkets) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.UpdateMarkets[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *MsgUpdateMarketsResponse) 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 *MsgUpdateMarketsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgUpdateMarketsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgParams) 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 *MsgParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Authority) > 0 { - i -= len(m.Authority) - copy(dAtA[i:], m.Authority) - i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) - i-- - dAtA[i] = 0x12 - } - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - -func (m *MsgParamsResponse) 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 *MsgParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *MsgRemoveMarketAuthorities) 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 *MsgRemoveMarketAuthorities) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveMarketAuthorities) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Admin) > 0 { - i -= len(m.Admin) - copy(dAtA[i:], m.Admin) - i = encodeVarintTx(dAtA, i, uint64(len(m.Admin))) - i-- - dAtA[i] = 0x12 - } - if len(m.RemoveAddresses) > 0 { - for iNdEx := len(m.RemoveAddresses) - 1; iNdEx >= 0; iNdEx-- { - i -= len(m.RemoveAddresses[iNdEx]) - copy(dAtA[i:], m.RemoveAddresses[iNdEx]) - i = encodeVarintTx(dAtA, i, uint64(len(m.RemoveAddresses[iNdEx]))) - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - -func (m *MsgRemoveMarketAuthoritiesResponse) 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 *MsgRemoveMarketAuthoritiesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *MsgRemoveMarketAuthoritiesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func encodeVarintTx(dAtA []byte, offset int, v uint64) int { - offset -= sovTx(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *MsgCreateMarkets) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.CreateMarkets) > 0 { - for _, e := range m.CreateMarkets { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgCreateMarketsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgUpdateMarkets) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - if len(m.UpdateMarkets) > 0 { - for _, e := range m.UpdateMarkets { - l = e.Size() - n += 1 + l + sovTx(uint64(l)) - } - } - return n -} - -func (m *MsgUpdateMarketsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgParams) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovTx(uint64(l)) - l = len(m.Authority) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *MsgRemoveMarketAuthorities) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.RemoveAddresses) > 0 { - for _, s := range m.RemoveAddresses { - l = len(s) - n += 1 + l + sovTx(uint64(l)) - } - } - l = len(m.Admin) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - return n -} - -func (m *MsgRemoveMarketAuthoritiesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func sovTx(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozTx(x uint64) (n int) { - return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *MsgCreateMarkets) 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: MsgCreateMarkets: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field CreateMarkets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.CreateMarkets = append(m.CreateMarkets, Market{}) - if err := m.CreateMarkets[len(m.CreateMarkets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgCreateMarketsResponse) 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: MsgCreateMarketsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgCreateMarketsResponse: 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 (m *MsgUpdateMarkets) 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: MsgUpdateMarkets: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateMarkets: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UpdateMarkets", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.UpdateMarkets = append(m.UpdateMarkets, Market{}) - if err := m.UpdateMarkets[len(m.UpdateMarkets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTx(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthTx - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *MsgUpdateMarketsResponse) 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: MsgUpdateMarketsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgUpdateMarketsResponse: 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 (m *MsgParams) 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: MsgParams: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgParams: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTx - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthTx - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthTx - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Authority = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - 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 *MsgParamsResponse) 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: MsgParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgParamsResponse: 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 (m *MsgRemoveMarketAuthorities) 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: MsgRemoveMarketAuthorities: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveMarketAuthorities: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RemoveAddresses", 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.RemoveAddresses = append(m.RemoveAddresses, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Admin", 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.Admin = 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 *MsgRemoveMarketAuthoritiesResponse) 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: MsgRemoveMarketAuthoritiesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: MsgRemoveMarketAuthoritiesResponse: 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 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTx - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthTx - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupTx - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthTx - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/oracle/keeper/grpc_query_test.go b/x/oracle/keeper/grpc_query_test.go index ba45f5f22..358339b74 100644 --- a/x/oracle/keeper/grpc_query_test.go +++ b/x/oracle/keeper/grpc_query_test.go @@ -5,7 +5,7 @@ import ( "github.com/stretchr/testify/mock" slinkytypes "github.com/skip-mev/slinky/pkg/types" - marketmaptypes "github.com/skip-mev/slinky/x/mm2/types" + marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types" "github.com/skip-mev/slinky/x/oracle/keeper" "github.com/skip-mev/slinky/x/oracle/types" ) diff --git a/x/oracle/keeper/hooks.go b/x/oracle/keeper/hooks.go index 1c1f03f50..70423405d 100644 --- a/x/oracle/keeper/hooks.go +++ b/x/oracle/keeper/hooks.go @@ -6,7 +6,6 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types" - mm2types "github.com/skip-mev/slinky/x/mm2/types" ) // Hooks is a wrapper struct around Keeper. @@ -14,58 +13,30 @@ type Hooks struct { k *Keeper } -var ( - _ marketmaptypes.MarketMapHooks = Hooks{} - _ mm2types.MarketMapHooks = Hooks{} -) +var _ marketmaptypes.MarketMapHooks = Hooks{} // Hooks returns registered hooks for x/oracle. func (k *Keeper) Hooks() Hooks { return Hooks{k} } -// LegacyAfterMarketCreated is the marketmap hook for x/oracle that is run after a market is created in -// the marketmap. After the market is created, a currency pair and its state are initialized in the -// oracle module. -func (h Hooks) LegacyAfterMarketCreated(ctx sdk.Context, ticker marketmaptypes.Ticker) error { - return h.k.CreateCurrencyPair(ctx, ticker.CurrencyPair) -} - -func (h Hooks) LegacyAfterMarketUpdated(_ sdk.Context, _ marketmaptypes.Ticker) error { - // TODO finish - - return nil -} - -// LegacyAfterMarketGenesis verifies that all tickers set in the x/marketmap genesis are registered in -// the x/oracle module. -func (h Hooks) LegacyAfterMarketGenesis(ctx sdk.Context, tickers map[string]marketmaptypes.Ticker) error { - for _, ticker := range tickers { - if !h.k.HasCurrencyPair(ctx, ticker.CurrencyPair) { - return fmt.Errorf("currency pair %s is registered in x/marketmap but not in x/oracle", ticker.String()) - } - } - - return nil -} - // AfterMarketCreated is the marketmap hook for x/oracle that is run after a market is created in // the marketmap. After the market is created, a currency pair and its state are initialized in the // oracle module. -func (h Hooks) AfterMarketCreated(ctx sdk.Context, market mm2types.Market) error { +func (h Hooks) AfterMarketCreated(ctx sdk.Context, market marketmaptypes.Market) error { return h.k.CreateCurrencyPair(ctx, market.Ticker.CurrencyPair) } // AfterMarketUpdated is the marketmap hook for x/oracle that is run after a market is updated in // the marketmap. -func (h Hooks) AfterMarketUpdated(_ sdk.Context, _ mm2types.Market) error { +func (h Hooks) AfterMarketUpdated(_ sdk.Context, _ marketmaptypes.Market) error { // TODO return nil } // AfterMarketGenesis verifies that all markets set in the x/marketmap genesis are registered in // the x/oracle module. -func (h Hooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]mm2types.Market) error { +func (h Hooks) AfterMarketGenesis(ctx sdk.Context, markets map[string]marketmaptypes.Market) error { for _, market := range markets { if !h.k.HasCurrencyPair(ctx, market.Ticker.CurrencyPair) { return fmt.Errorf("currency pair %s is registered in x/marketmap but not in x/oracle", market.Ticker.String()) diff --git a/x/oracle/types/expected_keepers.go b/x/oracle/types/expected_keepers.go index 5508f2a19..63f99b46c 100644 --- a/x/oracle/types/expected_keepers.go +++ b/x/oracle/types/expected_keepers.go @@ -3,7 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/skip-mev/slinky/x/mm2/types" + "github.com/skip-mev/slinky/x/marketmap/types" ) // MarketMapKeeper is the expected keeper interface for the market map keeper. diff --git a/x/oracle/types/mocks/market_map_keeper.go b/x/oracle/types/mocks/market_map_keeper.go index 6cf95738c..0a32d0941 100644 --- a/x/oracle/types/mocks/market_map_keeper.go +++ b/x/oracle/types/mocks/market_map_keeper.go @@ -5,7 +5,7 @@ package mocks import ( mock "github.com/stretchr/testify/mock" - mm2types "github.com/skip-mev/slinky/x/mm2/types" + marketmaptypes "github.com/skip-mev/slinky/x/marketmap/types" types "github.com/cosmos/cosmos-sdk/types" ) @@ -16,22 +16,22 @@ type MarketMapKeeper struct { } // GetMarket provides a mock function with given fields: ctx, tickerStr -func (_m *MarketMapKeeper) GetMarket(ctx types.Context, tickerStr string) (mm2types.Market, error) { +func (_m *MarketMapKeeper) GetMarket(ctx types.Context, tickerStr string) (marketmaptypes.Market, error) { ret := _m.Called(ctx, tickerStr) if len(ret) == 0 { panic("no return value specified for GetMarket") } - var r0 mm2types.Market + var r0 marketmaptypes.Market var r1 error - if rf, ok := ret.Get(0).(func(types.Context, string) (mm2types.Market, error)); ok { + if rf, ok := ret.Get(0).(func(types.Context, string) (marketmaptypes.Market, error)); ok { return rf(ctx, tickerStr) } - if rf, ok := ret.Get(0).(func(types.Context, string) mm2types.Market); ok { + if rf, ok := ret.Get(0).(func(types.Context, string) marketmaptypes.Market); ok { r0 = rf(ctx, tickerStr) } else { - r0 = ret.Get(0).(mm2types.Market) + r0 = ret.Get(0).(marketmaptypes.Market) } if rf, ok := ret.Get(1).(func(types.Context, string) error); ok {