diff --git a/api/elys/amm/params.pulsar.go b/api/elys/amm/params.pulsar.go index 2ab085410..84a1bae93 100644 --- a/api/elys/amm/params.pulsar.go +++ b/api/elys/amm/params.pulsar.go @@ -15,29 +15,29 @@ import ( ) var ( - md_Params protoreflect.MessageDescriptor - fd_Params_pool_creation_fee protoreflect.FieldDescriptor - fd_Params_slippage_track_duration protoreflect.FieldDescriptor - fd_Params_enable_base_currency_paired_pool_only protoreflect.FieldDescriptor + md_LegacyParams protoreflect.MessageDescriptor + fd_LegacyParams_pool_creation_fee protoreflect.FieldDescriptor + fd_LegacyParams_slippage_track_duration protoreflect.FieldDescriptor + fd_LegacyParams_enable_base_currency_paired_pool_only protoreflect.FieldDescriptor ) func init() { file_elys_amm_params_proto_init() - md_Params = File_elys_amm_params_proto.Messages().ByName("Params") - fd_Params_pool_creation_fee = md_Params.Fields().ByName("pool_creation_fee") - fd_Params_slippage_track_duration = md_Params.Fields().ByName("slippage_track_duration") - fd_Params_enable_base_currency_paired_pool_only = md_Params.Fields().ByName("enable_base_currency_paired_pool_only") + md_LegacyParams = File_elys_amm_params_proto.Messages().ByName("LegacyParams") + fd_LegacyParams_pool_creation_fee = md_LegacyParams.Fields().ByName("pool_creation_fee") + fd_LegacyParams_slippage_track_duration = md_LegacyParams.Fields().ByName("slippage_track_duration") + fd_LegacyParams_enable_base_currency_paired_pool_only = md_LegacyParams.Fields().ByName("enable_base_currency_paired_pool_only") } -var _ protoreflect.Message = (*fastReflection_Params)(nil) +var _ protoreflect.Message = (*fastReflection_LegacyParams)(nil) -type fastReflection_Params Params +type fastReflection_LegacyParams LegacyParams -func (x *Params) ProtoReflect() protoreflect.Message { - return (*fastReflection_Params)(x) +func (x *LegacyParams) ProtoReflect() protoreflect.Message { + return (*fastReflection_LegacyParams)(x) } -func (x *Params) slowProtoReflect() protoreflect.Message { +func (x *LegacyParams) slowProtoReflect() protoreflect.Message { mi := &file_elys_amm_params_proto_msgTypes[0] if protoimpl.UnsafeEnabled && x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) @@ -49,43 +49,43 @@ func (x *Params) slowProtoReflect() protoreflect.Message { return mi.MessageOf(x) } -var _fastReflection_Params_messageType fastReflection_Params_messageType -var _ protoreflect.MessageType = fastReflection_Params_messageType{} +var _fastReflection_LegacyParams_messageType fastReflection_LegacyParams_messageType +var _ protoreflect.MessageType = fastReflection_LegacyParams_messageType{} -type fastReflection_Params_messageType struct{} +type fastReflection_LegacyParams_messageType struct{} -func (x fastReflection_Params_messageType) Zero() protoreflect.Message { - return (*fastReflection_Params)(nil) +func (x fastReflection_LegacyParams_messageType) Zero() protoreflect.Message { + return (*fastReflection_LegacyParams)(nil) } -func (x fastReflection_Params_messageType) New() protoreflect.Message { - return new(fastReflection_Params) +func (x fastReflection_LegacyParams_messageType) New() protoreflect.Message { + return new(fastReflection_LegacyParams) } -func (x fastReflection_Params_messageType) Descriptor() protoreflect.MessageDescriptor { - return md_Params +func (x fastReflection_LegacyParams_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_LegacyParams } // Descriptor returns message descriptor, which contains only the protobuf // type information for the message. -func (x *fastReflection_Params) Descriptor() protoreflect.MessageDescriptor { - return md_Params +func (x *fastReflection_LegacyParams) Descriptor() protoreflect.MessageDescriptor { + return md_LegacyParams } // 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 +func (x *fastReflection_LegacyParams) Type() protoreflect.MessageType { + return _fastReflection_LegacyParams_messageType } // New returns a newly allocated and mutable empty message. -func (x *fastReflection_Params) New() protoreflect.Message { - return new(fastReflection_Params) +func (x *fastReflection_LegacyParams) New() protoreflect.Message { + return new(fastReflection_LegacyParams) } // Interface unwraps the message reflection interface and // returns the underlying ProtoMessage interface. -func (x *fastReflection_Params) Interface() protoreflect.ProtoMessage { - return (*Params)(x) +func (x *fastReflection_LegacyParams) Interface() protoreflect.ProtoMessage { + return (*LegacyParams)(x) } // Range iterates over every populated field in an undefined order, @@ -93,22 +93,22 @@ func (x *fastReflection_Params) 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_Params) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { +func (x *fastReflection_LegacyParams) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { if x.PoolCreationFee != "" { value := protoreflect.ValueOfString(x.PoolCreationFee) - if !f(fd_Params_pool_creation_fee, value) { + if !f(fd_LegacyParams_pool_creation_fee, value) { return } } if x.SlippageTrackDuration != uint64(0) { value := protoreflect.ValueOfUint64(x.SlippageTrackDuration) - if !f(fd_Params_slippage_track_duration, value) { + if !f(fd_LegacyParams_slippage_track_duration, value) { return } } if x.EnableBaseCurrencyPairedPoolOnly != false { value := protoreflect.ValueOfBool(x.EnableBaseCurrencyPairedPoolOnly) - if !f(fd_Params_enable_base_currency_paired_pool_only, value) { + if !f(fd_LegacyParams_enable_base_currency_paired_pool_only, value) { return } } @@ -125,19 +125,19 @@ func (x *fastReflection_Params) 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_Params) Has(fd protoreflect.FieldDescriptor) bool { +func (x *fastReflection_LegacyParams) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { - case "elys.amm.Params.pool_creation_fee": + case "elys.amm.LegacyParams.pool_creation_fee": return x.PoolCreationFee != "" - case "elys.amm.Params.slippage_track_duration": + case "elys.amm.LegacyParams.slippage_track_duration": return x.SlippageTrackDuration != uint64(0) - case "elys.amm.Params.enable_base_currency_paired_pool_only": + case "elys.amm.LegacyParams.enable_base_currency_paired_pool_only": return x.EnableBaseCurrencyPairedPoolOnly != false default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.LegacyParams")) } - panic(fmt.Errorf("message elys.amm.Params does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message elys.amm.LegacyParams does not contain field %s", fd.FullName())) } } @@ -147,19 +147,19 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { // associated with the given field number. // // Clear is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { +func (x *fastReflection_LegacyParams) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { - case "elys.amm.Params.pool_creation_fee": + case "elys.amm.LegacyParams.pool_creation_fee": x.PoolCreationFee = "" - case "elys.amm.Params.slippage_track_duration": + case "elys.amm.LegacyParams.slippage_track_duration": x.SlippageTrackDuration = uint64(0) - case "elys.amm.Params.enable_base_currency_paired_pool_only": + case "elys.amm.LegacyParams.enable_base_currency_paired_pool_only": x.EnableBaseCurrencyPairedPoolOnly = false default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.LegacyParams")) } - panic(fmt.Errorf("message elys.amm.Params does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message elys.amm.LegacyParams does not contain field %s", fd.FullName())) } } @@ -169,22 +169,22 @@ func (x *fastReflection_Params) 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_Params) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LegacyParams) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { switch descriptor.FullName() { - case "elys.amm.Params.pool_creation_fee": + case "elys.amm.LegacyParams.pool_creation_fee": value := x.PoolCreationFee return protoreflect.ValueOfString(value) - case "elys.amm.Params.slippage_track_duration": + case "elys.amm.LegacyParams.slippage_track_duration": value := x.SlippageTrackDuration return protoreflect.ValueOfUint64(value) - case "elys.amm.Params.enable_base_currency_paired_pool_only": + case "elys.amm.LegacyParams.enable_base_currency_paired_pool_only": value := x.EnableBaseCurrencyPairedPoolOnly return protoreflect.ValueOfBool(value) default: if descriptor.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.LegacyParams")) } - panic(fmt.Errorf("message elys.amm.Params does not contain field %s", descriptor.FullName())) + panic(fmt.Errorf("message elys.amm.LegacyParams does not contain field %s", descriptor.FullName())) } } @@ -198,19 +198,19 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro // empty, read-only value, then it panics. // // Set is a mutating operation and unsafe for concurrent use. -func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { +func (x *fastReflection_LegacyParams) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { switch fd.FullName() { - case "elys.amm.Params.pool_creation_fee": + case "elys.amm.LegacyParams.pool_creation_fee": x.PoolCreationFee = value.Interface().(string) - case "elys.amm.Params.slippage_track_duration": + case "elys.amm.LegacyParams.slippage_track_duration": x.SlippageTrackDuration = value.Uint() - case "elys.amm.Params.enable_base_currency_paired_pool_only": + case "elys.amm.LegacyParams.enable_base_currency_paired_pool_only": x.EnableBaseCurrencyPairedPoolOnly = value.Bool() default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.LegacyParams")) } - panic(fmt.Errorf("message elys.amm.Params does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message elys.amm.LegacyParams does not contain field %s", fd.FullName())) } } @@ -224,48 +224,48 @@ func (x *fastReflection_Params) 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_Params) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { +func (x *fastReflection_LegacyParams) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "elys.amm.Params.pool_creation_fee": - panic(fmt.Errorf("field pool_creation_fee of message elys.amm.Params is not mutable")) - case "elys.amm.Params.slippage_track_duration": - panic(fmt.Errorf("field slippage_track_duration of message elys.amm.Params is not mutable")) - case "elys.amm.Params.enable_base_currency_paired_pool_only": - panic(fmt.Errorf("field enable_base_currency_paired_pool_only of message elys.amm.Params is not mutable")) + case "elys.amm.LegacyParams.pool_creation_fee": + panic(fmt.Errorf("field pool_creation_fee of message elys.amm.LegacyParams is not mutable")) + case "elys.amm.LegacyParams.slippage_track_duration": + panic(fmt.Errorf("field slippage_track_duration of message elys.amm.LegacyParams is not mutable")) + case "elys.amm.LegacyParams.enable_base_currency_paired_pool_only": + panic(fmt.Errorf("field enable_base_currency_paired_pool_only of message elys.amm.LegacyParams is not mutable")) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.LegacyParams")) } - panic(fmt.Errorf("message elys.amm.Params does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message elys.amm.LegacyParams 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 { +func (x *fastReflection_LegacyParams) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { switch fd.FullName() { - case "elys.amm.Params.pool_creation_fee": + case "elys.amm.LegacyParams.pool_creation_fee": return protoreflect.ValueOfString("") - case "elys.amm.Params.slippage_track_duration": + case "elys.amm.LegacyParams.slippage_track_duration": return protoreflect.ValueOfUint64(uint64(0)) - case "elys.amm.Params.enable_base_currency_paired_pool_only": + case "elys.amm.LegacyParams.enable_base_currency_paired_pool_only": return protoreflect.ValueOfBool(false) default: if fd.IsExtension() { - panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.LegacyParams")) } - panic(fmt.Errorf("message elys.amm.Params does not contain field %s", fd.FullName())) + panic(fmt.Errorf("message elys.amm.LegacyParams 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 { +func (x *fastReflection_LegacyParams) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { switch d.FullName() { default: - panic(fmt.Errorf("%s is not a oneof field in elys.amm.Params", d.FullName())) + panic(fmt.Errorf("%s is not a oneof field in elys.amm.LegacyParams", d.FullName())) } panic("unreachable") } @@ -273,7 +273,7 @@ func (x *fastReflection_Params) 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_Params) GetUnknown() protoreflect.RawFields { +func (x *fastReflection_LegacyParams) GetUnknown() protoreflect.RawFields { return x.unknownFields } @@ -284,7 +284,7 @@ func (x *fastReflection_Params) 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_Params) SetUnknown(fields protoreflect.RawFields) { +func (x *fastReflection_LegacyParams) SetUnknown(fields protoreflect.RawFields) { x.unknownFields = fields } @@ -296,7 +296,7 @@ func (x *fastReflection_Params) 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_Params) IsValid() bool { +func (x *fastReflection_LegacyParams) IsValid() bool { return x != nil } @@ -306,9 +306,9 @@ func (x *fastReflection_Params) 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_Params) ProtoMethods() *protoiface.Methods { +func (x *fastReflection_LegacyParams) ProtoMethods() *protoiface.Methods { size := func(input protoiface.SizeInput) protoiface.SizeOutput { - x := input.Message.Interface().(*Params) + x := input.Message.Interface().(*LegacyParams) if x == nil { return protoiface.SizeOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -340,7 +340,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { - x := input.Message.Interface().(*Params) + x := input.Message.Interface().(*LegacyParams) if x == nil { return protoiface.MarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -392,7 +392,7 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { }, nil } unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { - x := input.Message.Interface().(*Params) + x := input.Message.Interface().(*LegacyParams) if x == nil { return protoiface.UnmarshalOutput{ NoUnkeyedLiterals: input.NoUnkeyedLiterals, @@ -424,10 +424,10 @@ func (x *fastReflection_Params) 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: Params: wiretype end group for non-group") + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LegacyParams: 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) + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: LegacyParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -536,137 +536,1336 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { } } -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.27.0 -// protoc (unknown) -// source: elys/amm/params.proto +var _ protoreflect.List = (*_Params_3_list)(nil) -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) +type _Params_3_list struct { + list *[]string +} -// Params defines the parameters for the module. -type Params struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields +func (x *_Params_3_list) Len() int { + if x.list == nil { + return 0 + } + return len(*x.list) +} - PoolCreationFee string `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3" json:"pool_creation_fee,omitempty"` - SlippageTrackDuration uint64 `protobuf:"varint,2,opt,name=slippage_track_duration,json=slippageTrackDuration,proto3" json:"slippage_track_duration,omitempty"` // default 1 week: 604,800 - EnableBaseCurrencyPairedPoolOnly bool `protobuf:"varint,3,opt,name=enable_base_currency_paired_pool_only,json=enableBaseCurrencyPairedPoolOnly,proto3" json:"enable_base_currency_paired_pool_only,omitempty"` +func (x *_Params_3_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) } -func (x *Params) Reset() { - *x = Params{} - if protoimpl.UnsafeEnabled { - mi := &file_elys_amm_params_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } +func (x *_Params_3_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue } -func (x *Params) String() string { - return protoimpl.X.MessageStringOf(x) +func (x *_Params_3_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) } -func (*Params) ProtoMessage() {} +func (x *_Params_3_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message Params at list field BaseAssets as it is not of Message kind")) +} -// Deprecated: Use Params.ProtoReflect.Descriptor instead. -func (*Params) Descriptor() ([]byte, []int) { - return file_elys_amm_params_proto_rawDescGZIP(), []int{0} +func (x *_Params_3_list) Truncate(n int) { + *x.list = (*x.list)[:n] } -func (x *Params) GetPoolCreationFee() string { - if x != nil { - return x.PoolCreationFee - } - return "" +func (x *_Params_3_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) } -func (x *Params) GetSlippageTrackDuration() uint64 { - if x != nil { - return x.SlippageTrackDuration - } - return 0 +func (x *_Params_3_list) IsValid() bool { + return x.list != nil } -func (x *Params) GetEnableBaseCurrencyPairedPoolOnly() bool { - if x != nil { - return x.EnableBaseCurrencyPairedPoolOnly +var _ protoreflect.List = (*_Params_9_list)(nil) + +type _Params_9_list struct { + list *[]string +} + +func (x *_Params_9_list) Len() int { + if x.list == nil { + return 0 } - return false + return len(*x.list) } -var File_elys_amm_params_proto protoreflect.FileDescriptor +func (x *_Params_9_list) Get(i int) protoreflect.Value { + return protoreflect.ValueOfString((*x.list)[i]) +} -var file_elys_amm_params_proto_rawDesc = []byte{ - 0x0a, 0x15, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, - 0x6d, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, - 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xea, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x57, 0x0a, - 0x11, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, - 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, - 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, - 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0f, 0x70, 0x6f, 0x6f, 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, - 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x73, 0x6c, 0x69, 0x70, 0x70, 0x61, - 0x67, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x64, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, - 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x73, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, - 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, - 0x0a, 0x25, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x63, 0x75, - 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, 0x72, 0x65, 0x64, 0x5f, 0x70, 0x6f, - 0x6f, 0x6c, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x20, 0x65, - 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x61, 0x73, 0x65, 0x43, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, - 0x79, 0x50, 0x61, 0x69, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6f, 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x42, - 0x87, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, - 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, - 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x79, 0x73, - 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x70, - 0x69, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0xa2, 0x02, 0x03, 0x45, 0x41, 0x58, - 0xaa, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x41, 0x6d, 0x6d, 0xca, 0x02, 0x08, 0x45, 0x6c, - 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0xe2, 0x02, 0x14, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, - 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, - 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x41, 0x6d, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, - 0x33, +func (x *_Params_9_list) Set(i int, value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + (*x.list)[i] = concreteValue +} + +func (x *_Params_9_list) Append(value protoreflect.Value) { + valueUnwrapped := value.String() + concreteValue := valueUnwrapped + *x.list = append(*x.list, concreteValue) +} + +func (x *_Params_9_list) AppendMutable() protoreflect.Value { + panic(fmt.Errorf("AppendMutable can not be called on message Params at list field AllowedPoolCreators as it is not of Message kind")) +} + +func (x *_Params_9_list) Truncate(n int) { + *x.list = (*x.list)[:n] +} + +func (x *_Params_9_list) NewElement() protoreflect.Value { + v := "" + return protoreflect.ValueOfString(v) +} + +func (x *_Params_9_list) IsValid() bool { + return x.list != nil } var ( - file_elys_amm_params_proto_rawDescOnce sync.Once - file_elys_amm_params_proto_rawDescData = file_elys_amm_params_proto_rawDesc + md_Params protoreflect.MessageDescriptor + fd_Params_pool_creation_fee protoreflect.FieldDescriptor + fd_Params_slippage_track_duration protoreflect.FieldDescriptor + fd_Params_base_assets protoreflect.FieldDescriptor + fd_Params_weight_breaking_fee_exponent protoreflect.FieldDescriptor + fd_Params_weight_breaking_fee_multiplier protoreflect.FieldDescriptor + fd_Params_weight_breaking_fee_portion protoreflect.FieldDescriptor + fd_Params_weight_recovery_fee_portion protoreflect.FieldDescriptor + fd_Params_threshold_weight_difference protoreflect.FieldDescriptor + fd_Params_allowed_pool_creators protoreflect.FieldDescriptor ) -func file_elys_amm_params_proto_rawDescGZIP() []byte { - file_elys_amm_params_proto_rawDescOnce.Do(func() { - file_elys_amm_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_elys_amm_params_proto_rawDescData) - }) - return file_elys_amm_params_proto_rawDescData +func init() { + file_elys_amm_params_proto_init() + md_Params = File_elys_amm_params_proto.Messages().ByName("Params") + fd_Params_pool_creation_fee = md_Params.Fields().ByName("pool_creation_fee") + fd_Params_slippage_track_duration = md_Params.Fields().ByName("slippage_track_duration") + fd_Params_base_assets = md_Params.Fields().ByName("base_assets") + fd_Params_weight_breaking_fee_exponent = md_Params.Fields().ByName("weight_breaking_fee_exponent") + fd_Params_weight_breaking_fee_multiplier = md_Params.Fields().ByName("weight_breaking_fee_multiplier") + fd_Params_weight_breaking_fee_portion = md_Params.Fields().ByName("weight_breaking_fee_portion") + fd_Params_weight_recovery_fee_portion = md_Params.Fields().ByName("weight_recovery_fee_portion") + fd_Params_threshold_weight_difference = md_Params.Fields().ByName("threshold_weight_difference") + fd_Params_allowed_pool_creators = md_Params.Fields().ByName("allowed_pool_creators") } -var file_elys_amm_params_proto_msgTypes = make([]protoimpl.MessageInfo, 1) -var file_elys_amm_params_proto_goTypes = []interface{}{ - (*Params)(nil), // 0: elys.amm.Params +var _ protoreflect.Message = (*fastReflection_Params)(nil) + +type fastReflection_Params Params + +func (x *Params) ProtoReflect() protoreflect.Message { + return (*fastReflection_Params)(x) } -var file_elys_amm_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 (x *Params) slowProtoReflect() protoreflect.Message { + mi := &file_elys_amm_params_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) } -func init() { file_elys_amm_params_proto_init() } -func file_elys_amm_params_proto_init() { - if File_elys_amm_params_proto != nil { - return +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 x.PoolCreationFee != "" { + value := protoreflect.ValueOfString(x.PoolCreationFee) + if !f(fd_Params_pool_creation_fee, value) { + return + } } - if !protoimpl.UnsafeEnabled { - file_elys_amm_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + if x.SlippageTrackDuration != uint64(0) { + value := protoreflect.ValueOfUint64(x.SlippageTrackDuration) + if !f(fd_Params_slippage_track_duration, value) { + return + } + } + if len(x.BaseAssets) != 0 { + value := protoreflect.ValueOfList(&_Params_3_list{list: &x.BaseAssets}) + if !f(fd_Params_base_assets, value) { + return + } + } + if x.WeightBreakingFeeExponent != "" { + value := protoreflect.ValueOfString(x.WeightBreakingFeeExponent) + if !f(fd_Params_weight_breaking_fee_exponent, value) { + return + } + } + if x.WeightBreakingFeeMultiplier != "" { + value := protoreflect.ValueOfString(x.WeightBreakingFeeMultiplier) + if !f(fd_Params_weight_breaking_fee_multiplier, value) { + return + } + } + if x.WeightBreakingFeePortion != "" { + value := protoreflect.ValueOfString(x.WeightBreakingFeePortion) + if !f(fd_Params_weight_breaking_fee_portion, value) { + return + } + } + if x.WeightRecoveryFeePortion != "" { + value := protoreflect.ValueOfString(x.WeightRecoveryFeePortion) + if !f(fd_Params_weight_recovery_fee_portion, value) { + return + } + } + if x.ThresholdWeightDifference != "" { + value := protoreflect.ValueOfString(x.ThresholdWeightDifference) + if !f(fd_Params_threshold_weight_difference, value) { + return + } + } + if len(x.AllowedPoolCreators) != 0 { + value := protoreflect.ValueOfList(&_Params_9_list{list: &x.AllowedPoolCreators}) + if !f(fd_Params_allowed_pool_creators, 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 "elys.amm.Params.pool_creation_fee": + return x.PoolCreationFee != "" + case "elys.amm.Params.slippage_track_duration": + return x.SlippageTrackDuration != uint64(0) + case "elys.amm.Params.base_assets": + return len(x.BaseAssets) != 0 + case "elys.amm.Params.weight_breaking_fee_exponent": + return x.WeightBreakingFeeExponent != "" + case "elys.amm.Params.weight_breaking_fee_multiplier": + return x.WeightBreakingFeeMultiplier != "" + case "elys.amm.Params.weight_breaking_fee_portion": + return x.WeightBreakingFeePortion != "" + case "elys.amm.Params.weight_recovery_fee_portion": + return x.WeightRecoveryFeePortion != "" + case "elys.amm.Params.threshold_weight_difference": + return x.ThresholdWeightDifference != "" + case "elys.amm.Params.allowed_pool_creators": + return len(x.AllowedPoolCreators) != 0 + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + } + panic(fmt.Errorf("message elys.amm.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 "elys.amm.Params.pool_creation_fee": + x.PoolCreationFee = "" + case "elys.amm.Params.slippage_track_duration": + x.SlippageTrackDuration = uint64(0) + case "elys.amm.Params.base_assets": + x.BaseAssets = nil + case "elys.amm.Params.weight_breaking_fee_exponent": + x.WeightBreakingFeeExponent = "" + case "elys.amm.Params.weight_breaking_fee_multiplier": + x.WeightBreakingFeeMultiplier = "" + case "elys.amm.Params.weight_breaking_fee_portion": + x.WeightBreakingFeePortion = "" + case "elys.amm.Params.weight_recovery_fee_portion": + x.WeightRecoveryFeePortion = "" + case "elys.amm.Params.threshold_weight_difference": + x.ThresholdWeightDifference = "" + case "elys.amm.Params.allowed_pool_creators": + x.AllowedPoolCreators = nil + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + } + panic(fmt.Errorf("message elys.amm.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 "elys.amm.Params.pool_creation_fee": + value := x.PoolCreationFee + return protoreflect.ValueOfString(value) + case "elys.amm.Params.slippage_track_duration": + value := x.SlippageTrackDuration + return protoreflect.ValueOfUint64(value) + case "elys.amm.Params.base_assets": + if len(x.BaseAssets) == 0 { + return protoreflect.ValueOfList(&_Params_3_list{}) + } + listValue := &_Params_3_list{list: &x.BaseAssets} + return protoreflect.ValueOfList(listValue) + case "elys.amm.Params.weight_breaking_fee_exponent": + value := x.WeightBreakingFeeExponent + return protoreflect.ValueOfString(value) + case "elys.amm.Params.weight_breaking_fee_multiplier": + value := x.WeightBreakingFeeMultiplier + return protoreflect.ValueOfString(value) + case "elys.amm.Params.weight_breaking_fee_portion": + value := x.WeightBreakingFeePortion + return protoreflect.ValueOfString(value) + case "elys.amm.Params.weight_recovery_fee_portion": + value := x.WeightRecoveryFeePortion + return protoreflect.ValueOfString(value) + case "elys.amm.Params.threshold_weight_difference": + value := x.ThresholdWeightDifference + return protoreflect.ValueOfString(value) + case "elys.amm.Params.allowed_pool_creators": + if len(x.AllowedPoolCreators) == 0 { + return protoreflect.ValueOfList(&_Params_9_list{}) + } + listValue := &_Params_9_list{list: &x.AllowedPoolCreators} + return protoreflect.ValueOfList(listValue) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + } + panic(fmt.Errorf("message elys.amm.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 "elys.amm.Params.pool_creation_fee": + x.PoolCreationFee = value.Interface().(string) + case "elys.amm.Params.slippage_track_duration": + x.SlippageTrackDuration = value.Uint() + case "elys.amm.Params.base_assets": + lv := value.List() + clv := lv.(*_Params_3_list) + x.BaseAssets = *clv.list + case "elys.amm.Params.weight_breaking_fee_exponent": + x.WeightBreakingFeeExponent = value.Interface().(string) + case "elys.amm.Params.weight_breaking_fee_multiplier": + x.WeightBreakingFeeMultiplier = value.Interface().(string) + case "elys.amm.Params.weight_breaking_fee_portion": + x.WeightBreakingFeePortion = value.Interface().(string) + case "elys.amm.Params.weight_recovery_fee_portion": + x.WeightRecoveryFeePortion = value.Interface().(string) + case "elys.amm.Params.threshold_weight_difference": + x.ThresholdWeightDifference = value.Interface().(string) + case "elys.amm.Params.allowed_pool_creators": + lv := value.List() + clv := lv.(*_Params_9_list) + x.AllowedPoolCreators = *clv.list + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + } + panic(fmt.Errorf("message elys.amm.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 "elys.amm.Params.base_assets": + if x.BaseAssets == nil { + x.BaseAssets = []string{} + } + value := &_Params_3_list{list: &x.BaseAssets} + return protoreflect.ValueOfList(value) + case "elys.amm.Params.allowed_pool_creators": + if x.AllowedPoolCreators == nil { + x.AllowedPoolCreators = []string{} + } + value := &_Params_9_list{list: &x.AllowedPoolCreators} + return protoreflect.ValueOfList(value) + case "elys.amm.Params.pool_creation_fee": + panic(fmt.Errorf("field pool_creation_fee of message elys.amm.Params is not mutable")) + case "elys.amm.Params.slippage_track_duration": + panic(fmt.Errorf("field slippage_track_duration of message elys.amm.Params is not mutable")) + case "elys.amm.Params.weight_breaking_fee_exponent": + panic(fmt.Errorf("field weight_breaking_fee_exponent of message elys.amm.Params is not mutable")) + case "elys.amm.Params.weight_breaking_fee_multiplier": + panic(fmt.Errorf("field weight_breaking_fee_multiplier of message elys.amm.Params is not mutable")) + case "elys.amm.Params.weight_breaking_fee_portion": + panic(fmt.Errorf("field weight_breaking_fee_portion of message elys.amm.Params is not mutable")) + case "elys.amm.Params.weight_recovery_fee_portion": + panic(fmt.Errorf("field weight_recovery_fee_portion of message elys.amm.Params is not mutable")) + case "elys.amm.Params.threshold_weight_difference": + panic(fmt.Errorf("field threshold_weight_difference of message elys.amm.Params is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + } + panic(fmt.Errorf("message elys.amm.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 "elys.amm.Params.pool_creation_fee": + return protoreflect.ValueOfString("") + case "elys.amm.Params.slippage_track_duration": + return protoreflect.ValueOfUint64(uint64(0)) + case "elys.amm.Params.base_assets": + list := []string{} + return protoreflect.ValueOfList(&_Params_3_list{list: &list}) + case "elys.amm.Params.weight_breaking_fee_exponent": + return protoreflect.ValueOfString("") + case "elys.amm.Params.weight_breaking_fee_multiplier": + return protoreflect.ValueOfString("") + case "elys.amm.Params.weight_breaking_fee_portion": + return protoreflect.ValueOfString("") + case "elys.amm.Params.weight_recovery_fee_portion": + return protoreflect.ValueOfString("") + case "elys.amm.Params.threshold_weight_difference": + return protoreflect.ValueOfString("") + case "elys.amm.Params.allowed_pool_creators": + list := []string{} + return protoreflect.ValueOfList(&_Params_9_list{list: &list}) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.Params")) + } + panic(fmt.Errorf("message elys.amm.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 elys.amm.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 + l = len(x.PoolCreationFee) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.SlippageTrackDuration != 0 { + n += 1 + runtime.Sov(uint64(x.SlippageTrackDuration)) + } + if len(x.BaseAssets) > 0 { + for _, s := range x.BaseAssets { + l = len(s) + n += 1 + l + runtime.Sov(uint64(l)) + } + } + l = len(x.WeightBreakingFeeExponent) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.WeightBreakingFeeMultiplier) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.WeightBreakingFeePortion) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.WeightRecoveryFeePortion) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.ThresholdWeightDifference) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if len(x.AllowedPoolCreators) > 0 { + for _, s := range x.AllowedPoolCreators { + 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().(*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.AllowedPoolCreators) > 0 { + for iNdEx := len(x.AllowedPoolCreators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.AllowedPoolCreators[iNdEx]) + copy(dAtA[i:], x.AllowedPoolCreators[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.AllowedPoolCreators[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + if len(x.ThresholdWeightDifference) > 0 { + i -= len(x.ThresholdWeightDifference) + copy(dAtA[i:], x.ThresholdWeightDifference) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ThresholdWeightDifference))) + i-- + dAtA[i] = 0x42 + } + if len(x.WeightRecoveryFeePortion) > 0 { + i -= len(x.WeightRecoveryFeePortion) + copy(dAtA[i:], x.WeightRecoveryFeePortion) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightRecoveryFeePortion))) + i-- + dAtA[i] = 0x3a + } + if len(x.WeightBreakingFeePortion) > 0 { + i -= len(x.WeightBreakingFeePortion) + copy(dAtA[i:], x.WeightBreakingFeePortion) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeePortion))) + i-- + dAtA[i] = 0x32 + } + if len(x.WeightBreakingFeeMultiplier) > 0 { + i -= len(x.WeightBreakingFeeMultiplier) + copy(dAtA[i:], x.WeightBreakingFeeMultiplier) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeeMultiplier))) + i-- + dAtA[i] = 0x2a + } + if len(x.WeightBreakingFeeExponent) > 0 { + i -= len(x.WeightBreakingFeeExponent) + copy(dAtA[i:], x.WeightBreakingFeeExponent) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeeExponent))) + i-- + dAtA[i] = 0x22 + } + if len(x.BaseAssets) > 0 { + for iNdEx := len(x.BaseAssets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(x.BaseAssets[iNdEx]) + copy(dAtA[i:], x.BaseAssets[iNdEx]) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.BaseAssets[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if x.SlippageTrackDuration != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.SlippageTrackDuration)) + i-- + dAtA[i] = 0x10 + } + if len(x.PoolCreationFee) > 0 { + i -= len(x.PoolCreationFee) + copy(dAtA[i:], x.PoolCreationFee) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.PoolCreationFee))) + 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 PoolCreationFee", 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.PoolCreationFee = 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 SlippageTrackDuration", wireType) + } + x.SlippageTrackDuration = 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.SlippageTrackDuration |= 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 BaseAssets", 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.BaseAssets = append(x.BaseAssets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeExponent", 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.WeightBreakingFeeExponent = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeMultiplier", 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.WeightBreakingFeeMultiplier = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 6: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeePortion", 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.WeightBreakingFeePortion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 7: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightRecoveryFeePortion", 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.WeightRecoveryFeePortion = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 8: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ThresholdWeightDifference", 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.ThresholdWeightDifference = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 9: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field AllowedPoolCreators", 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.AllowedPoolCreators = append(x.AllowedPoolCreators, 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: elys/amm/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 module. +type LegacyParams struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PoolCreationFee string `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3" json:"pool_creation_fee,omitempty"` + SlippageTrackDuration uint64 `protobuf:"varint,2,opt,name=slippage_track_duration,json=slippageTrackDuration,proto3" json:"slippage_track_duration,omitempty"` // default 1 week: 604,800 + EnableBaseCurrencyPairedPoolOnly bool `protobuf:"varint,3,opt,name=enable_base_currency_paired_pool_only,json=enableBaseCurrencyPairedPoolOnly,proto3" json:"enable_base_currency_paired_pool_only,omitempty"` +} + +func (x *LegacyParams) Reset() { + *x = LegacyParams{} + if protoimpl.UnsafeEnabled { + mi := &file_elys_amm_params_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *LegacyParams) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*LegacyParams) ProtoMessage() {} + +// Deprecated: Use LegacyParams.ProtoReflect.Descriptor instead. +func (*LegacyParams) Descriptor() ([]byte, []int) { + return file_elys_amm_params_proto_rawDescGZIP(), []int{0} +} + +func (x *LegacyParams) GetPoolCreationFee() string { + if x != nil { + return x.PoolCreationFee + } + return "" +} + +func (x *LegacyParams) GetSlippageTrackDuration() uint64 { + if x != nil { + return x.SlippageTrackDuration + } + return 0 +} + +func (x *LegacyParams) GetEnableBaseCurrencyPairedPoolOnly() bool { + if x != nil { + return x.EnableBaseCurrencyPairedPoolOnly + } + return false +} + +type Params struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PoolCreationFee string `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3" json:"pool_creation_fee,omitempty"` + SlippageTrackDuration uint64 `protobuf:"varint,2,opt,name=slippage_track_duration,json=slippageTrackDuration,proto3" json:"slippage_track_duration,omitempty"` // default 1 week: 604,800 + BaseAssets []string `protobuf:"bytes,3,rep,name=base_assets,json=baseAssets,proto3" json:"base_assets,omitempty"` + WeightBreakingFeeExponent string `protobuf:"bytes,4,opt,name=weight_breaking_fee_exponent,json=weightBreakingFeeExponent,proto3" json:"weight_breaking_fee_exponent,omitempty"` + WeightBreakingFeeMultiplier string `protobuf:"bytes,5,opt,name=weight_breaking_fee_multiplier,json=weightBreakingFeeMultiplier,proto3" json:"weight_breaking_fee_multiplier,omitempty"` + WeightBreakingFeePortion string `protobuf:"bytes,6,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3" json:"weight_breaking_fee_portion,omitempty"` + WeightRecoveryFeePortion string `protobuf:"bytes,7,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3" json:"weight_recovery_fee_portion,omitempty"` + ThresholdWeightDifference string `protobuf:"bytes,8,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3" json:"threshold_weight_difference,omitempty"` + AllowedPoolCreators []string `protobuf:"bytes,9,rep,name=allowed_pool_creators,json=allowedPoolCreators,proto3" json:"allowed_pool_creators,omitempty"` +} + +func (x *Params) Reset() { + *x = Params{} + if protoimpl.UnsafeEnabled { + mi := &file_elys_amm_params_proto_msgTypes[1] + 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_elys_amm_params_proto_rawDescGZIP(), []int{1} +} + +func (x *Params) GetPoolCreationFee() string { + if x != nil { + return x.PoolCreationFee + } + return "" +} + +func (x *Params) GetSlippageTrackDuration() uint64 { + if x != nil { + return x.SlippageTrackDuration + } + return 0 +} + +func (x *Params) GetBaseAssets() []string { + if x != nil { + return x.BaseAssets + } + return nil +} + +func (x *Params) GetWeightBreakingFeeExponent() string { + if x != nil { + return x.WeightBreakingFeeExponent + } + return "" +} + +func (x *Params) GetWeightBreakingFeeMultiplier() string { + if x != nil { + return x.WeightBreakingFeeMultiplier + } + return "" +} + +func (x *Params) GetWeightBreakingFeePortion() string { + if x != nil { + return x.WeightBreakingFeePortion + } + return "" +} + +func (x *Params) GetWeightRecoveryFeePortion() string { + if x != nil { + return x.WeightRecoveryFeePortion + } + return "" +} + +func (x *Params) GetThresholdWeightDifference() string { + if x != nil { + return x.ThresholdWeightDifference + } + return "" +} + +func (x *Params) GetAllowedPoolCreators() []string { + if x != nil { + return x.AllowedPoolCreators + } + return nil +} + +var File_elys_amm_params_proto protoreflect.FileDescriptor + +var file_elys_amm_params_proto_rawDesc = []byte{ + 0x0a, 0x15, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x08, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, + 0x6d, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, + 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x22, 0xf0, 0x01, 0x0a, 0x0c, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x12, 0x57, 0x0a, 0x11, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0f, 0x70, 0x6f, 0x6f, + 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x12, 0x36, 0x0a, 0x17, + 0x73, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x64, + 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x73, + 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x44, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x4f, 0x0a, 0x25, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x62, + 0x61, 0x73, 0x65, 0x5f, 0x63, 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x5f, 0x70, 0x61, 0x69, + 0x72, 0x65, 0x64, 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x6f, 0x6e, 0x6c, 0x79, 0x18, 0x03, 0x20, + 0x01, 0x28, 0x08, 0x52, 0x20, 0x65, 0x6e, 0x61, 0x62, 0x6c, 0x65, 0x42, 0x61, 0x73, 0x65, 0x43, + 0x75, 0x72, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x50, 0x61, 0x69, 0x72, 0x65, 0x64, 0x50, 0x6f, 0x6f, + 0x6c, 0x4f, 0x6e, 0x6c, 0x79, 0x22, 0xb1, 0x06, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x12, 0x57, 0x0a, 0x11, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, + 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0f, 0x70, 0x6f, 0x6f, 0x6c, 0x43, 0x72, + 0x65, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x46, 0x65, 0x65, 0x12, 0x36, 0x0a, 0x17, 0x73, 0x6c, 0x69, + 0x70, 0x70, 0x61, 0x67, 0x65, 0x5f, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x5f, 0x64, 0x75, 0x72, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x15, 0x73, 0x6c, 0x69, 0x70, + 0x70, 0x61, 0x67, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x44, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x12, 0x1f, 0x0a, 0x0b, 0x62, 0x61, 0x73, 0x65, 0x5f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, + 0x18, 0x03, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0a, 0x62, 0x61, 0x73, 0x65, 0x41, 0x73, 0x73, 0x65, + 0x74, 0x73, 0x12, 0x72, 0x0a, 0x1c, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x62, 0x72, 0x65, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x65, 0x78, 0x70, 0x6f, 0x6e, 0x65, + 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, + 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, + 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x77, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x65, 0x65, 0x45, 0x78, + 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x76, 0x0a, 0x1e, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x6d, 0x75, + 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0x52, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x46, 0x65, 0x65, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x70, + 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, + 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, + 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x18, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, + 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x65, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, + 0x12, 0x70, 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, + 0x65, 0x72, 0x79, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, + 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x18, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, + 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x71, 0x0a, 0x1b, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x5f, + 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, + 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, + 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, + 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x74, 0x68, 0x72, 0x65, + 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, 0x66, 0x66, 0x65, + 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x32, 0x0a, 0x15, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, + 0x5f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x18, 0x09, + 0x20, 0x03, 0x28, 0x09, 0x52, 0x13, 0x61, 0x6c, 0x6c, 0x6f, 0x77, 0x65, 0x64, 0x50, 0x6f, 0x6f, + 0x6c, 0x43, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x73, 0x42, 0x87, 0x01, 0x0a, 0x0c, 0x63, 0x6f, + 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x42, 0x0b, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, 0x79, 0x73, + 0x2f, 0x61, 0x6d, 0x6d, 0xa2, 0x02, 0x03, 0x45, 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, 0x6c, 0x79, + 0x73, 0x2e, 0x41, 0x6d, 0x6d, 0xca, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, + 0xe2, 0x02, 0x14, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, + 0x41, 0x6d, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_elys_amm_params_proto_rawDescOnce sync.Once + file_elys_amm_params_proto_rawDescData = file_elys_amm_params_proto_rawDesc +) + +func file_elys_amm_params_proto_rawDescGZIP() []byte { + file_elys_amm_params_proto_rawDescOnce.Do(func() { + file_elys_amm_params_proto_rawDescData = protoimpl.X.CompressGZIP(file_elys_amm_params_proto_rawDescData) + }) + return file_elys_amm_params_proto_rawDescData +} + +var file_elys_amm_params_proto_msgTypes = make([]protoimpl.MessageInfo, 2) +var file_elys_amm_params_proto_goTypes = []interface{}{ + (*LegacyParams)(nil), // 0: elys.amm.LegacyParams + (*Params)(nil), // 1: elys.amm.Params +} +var file_elys_amm_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_elys_amm_params_proto_init() } +func file_elys_amm_params_proto_init() { + if File_elys_amm_params_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_elys_amm_params_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*LegacyParams); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_elys_amm_params_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*Params); i { case 0: return &v.state @@ -685,7 +1884,7 @@ func file_elys_amm_params_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_elys_amm_params_proto_rawDesc, NumEnums: 0, - NumMessages: 1, + NumMessages: 2, NumExtensions: 0, NumServices: 0, }, diff --git a/api/elys/amm/pool.pulsar.go b/api/elys/amm/pool.pulsar.go index 3633897d7..646f2b598 100644 --- a/api/elys/amm/pool.pulsar.go +++ b/api/elys/amm/pool.pulsar.go @@ -18,7 +18,7 @@ import ( var _ protoreflect.List = (*_LegacyPool_5_list)(nil) type _LegacyPool_5_list struct { - list *[]*LegacyPoolAsset + list *[]*PoolAsset } func (x *_LegacyPool_5_list) Len() int { @@ -34,18 +34,18 @@ func (x *_LegacyPool_5_list) Get(i int) protoreflect.Value { func (x *_LegacyPool_5_list) Set(i int, value protoreflect.Value) { valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*LegacyPoolAsset) + concreteValue := valueUnwrapped.Interface().(*PoolAsset) (*x.list)[i] = concreteValue } func (x *_LegacyPool_5_list) Append(value protoreflect.Value) { valueUnwrapped := value.Message() - concreteValue := valueUnwrapped.Interface().(*LegacyPoolAsset) + concreteValue := valueUnwrapped.Interface().(*PoolAsset) *x.list = append(*x.list, concreteValue) } func (x *_LegacyPool_5_list) AppendMutable() protoreflect.Value { - v := new(LegacyPoolAsset) + v := new(PoolAsset) *x.list = append(*x.list, v) return protoreflect.ValueOfMessage(v.ProtoReflect()) } @@ -58,7 +58,7 @@ func (x *_LegacyPool_5_list) Truncate(n int) { } func (x *_LegacyPool_5_list) NewElement() protoreflect.Value { - v := new(LegacyPoolAsset) + v := new(PoolAsset) return protoreflect.ValueOfMessage(v.ProtoReflect()) } @@ -363,7 +363,7 @@ func (x *fastReflection_LegacyPool) Mutable(fd protoreflect.FieldDescriptor) pro return protoreflect.ValueOfMessage(x.TotalShares.ProtoReflect()) case "elys.amm.LegacyPool.pool_assets": if x.PoolAssets == nil { - x.PoolAssets = []*LegacyPoolAsset{} + x.PoolAssets = []*PoolAsset{} } value := &_LegacyPool_5_list{list: &x.PoolAssets} return protoreflect.ValueOfList(value) @@ -399,7 +399,7 @@ func (x *fastReflection_LegacyPool) NewField(fd protoreflect.FieldDescriptor) pr m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) case "elys.amm.LegacyPool.pool_assets": - list := []*LegacyPoolAsset{} + list := []*PoolAsset{} return protoreflect.ValueOfList(&_LegacyPool_5_list{list: &list}) case "elys.amm.LegacyPool.total_weight": return protoreflect.ValueOfString("") @@ -803,7 +803,7 @@ func (x *fastReflection_LegacyPool) ProtoMethods() *protoiface.Methods { if postIndex > l { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF } - x.PoolAssets = append(x.PoolAssets, &LegacyPoolAsset{}) + x.PoolAssets = append(x.PoolAssets, &PoolAsset{}) if err := options.Unmarshal(dAtA[iNdEx:postIndex], x.PoolAssets[len(x.PoolAssets)-1]); err != nil { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } @@ -2891,13 +2891,13 @@ type LegacyPool struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` - PoolParams *LegacyPoolParams `protobuf:"bytes,3,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` - TotalShares *v1beta1.Coin `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` - PoolAssets []*LegacyPoolAsset `protobuf:"bytes,5,rep,name=pool_assets,json=poolAssets,proto3" json:"pool_assets,omitempty"` - TotalWeight string `protobuf:"bytes,6,opt,name=total_weight,json=totalWeight,proto3" json:"total_weight,omitempty"` - RebalanceTreasury string `protobuf:"bytes,7,opt,name=rebalance_treasury,json=rebalanceTreasury,proto3" json:"rebalance_treasury,omitempty"` + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` + PoolParams *LegacyPoolParams `protobuf:"bytes,3,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` + TotalShares *v1beta1.Coin `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3" json:"total_shares,omitempty"` + PoolAssets []*PoolAsset `protobuf:"bytes,5,rep,name=pool_assets,json=poolAssets,proto3" json:"pool_assets,omitempty"` + TotalWeight string `protobuf:"bytes,6,opt,name=total_weight,json=totalWeight,proto3" json:"total_weight,omitempty"` + RebalanceTreasury string `protobuf:"bytes,7,opt,name=rebalance_treasury,json=rebalanceTreasury,proto3" json:"rebalance_treasury,omitempty"` } func (x *LegacyPool) Reset() { @@ -2948,7 +2948,7 @@ func (x *LegacyPool) GetTotalShares() *v1beta1.Coin { return nil } -func (x *LegacyPool) GetPoolAssets() []*LegacyPoolAsset { +func (x *LegacyPool) GetPoolAssets() []*PoolAsset { if x != nil { return x.PoolAssets } @@ -3159,7 +3159,7 @@ var file_elys_amm_pool_proto_rawDesc = []byte{ 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x62, 0x61, 0x73, 0x65, 0x2f, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2f, 0x63, 0x6f, 0x69, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x87, 0x03, 0x0a, 0x0a, 0x4c, 0x65, 0x67, 0x61, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x81, 0x03, 0x0a, 0x0a, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, @@ -3172,74 +3172,73 @@ var file_elys_amm_pool_proto_rawDesc = []byte{ 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x73, - 0x12, 0x40, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, - 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, - 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, - 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x77, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, - 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, - 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x57, 0x65, 0x69, 0x67, - 0x68, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, - 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, - 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, - 0x79, 0x22, 0xf5, 0x02, 0x0a, 0x04, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, - 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, - 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, - 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, - 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, - 0x70, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0c, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, - 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, - 0x00, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x73, 0x12, 0x3a, - 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, - 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, - 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0c, 0x74, 0x6f, - 0x74, 0x61, 0x6c, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, - 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0b, 0x74, - 0x6f, 0x74, 0x61, 0x6c, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, - 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x79, - 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, - 0x65, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x79, 0x22, 0xad, 0x01, 0x0a, 0x0d, 0x50, 0x6f, - 0x6f, 0x6c, 0x45, 0x78, 0x74, 0x72, 0x61, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x43, 0x0a, 0x03, 0x74, - 0x76, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, - 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, - 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x03, 0x74, 0x76, 0x6c, - 0x12, 0x57, 0x0a, 0x0e, 0x6c, 0x70, 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x70, 0x72, 0x69, - 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, - 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, - 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x6c, 0x70, 0x54, - 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, 0x69, 0x63, 0x65, 0x22, 0xb7, 0x01, 0x0a, 0x17, 0x4f, 0x72, - 0x61, 0x63, 0x6c, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x53, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 0x65, - 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x1c, - 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, - 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x65, 0x0a, 0x07, - 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, - 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, - 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, - 0x6b, 0x65, 0x64, 0x42, 0x85, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x61, 0x6d, 0x6d, 0x42, 0x09, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, - 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, - 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, - 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0xa2, 0x02, 0x03, 0x45, - 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x41, 0x6d, 0x6d, 0xca, 0x02, 0x08, - 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0xe2, 0x02, 0x14, 0x45, 0x6c, 0x79, 0x73, 0x5c, - 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, - 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x41, 0x6d, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x33, + 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, + 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, + 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, + 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0c, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, + 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, + 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x2d, 0x0a, 0x12, + 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x5f, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, + 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x11, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, + 0x6e, 0x63, 0x65, 0x54, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x79, 0x22, 0xf5, 0x02, 0x0a, 0x04, + 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x18, 0x0a, + 0x07, 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x61, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, + 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, + 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, + 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x42, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0b, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x53, 0x68, 0x61, 0x72, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, + 0x5f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, + 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, + 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x73, + 0x73, 0x65, 0x74, 0x73, 0x12, 0x4e, 0x0a, 0x0c, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x77, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x57, 0x65, + 0x69, 0x67, 0x68, 0x74, 0x12, 0x2d, 0x0a, 0x12, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, + 0x65, 0x5f, 0x74, 0x72, 0x65, 0x61, 0x73, 0x75, 0x72, 0x79, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x11, 0x72, 0x65, 0x62, 0x61, 0x6c, 0x61, 0x6e, 0x63, 0x65, 0x54, 0x72, 0x65, 0x61, 0x73, + 0x75, 0x72, 0x79, 0x22, 0xad, 0x01, 0x0a, 0x0d, 0x50, 0x6f, 0x6f, 0x6c, 0x45, 0x78, 0x74, 0x72, + 0x61, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x43, 0x0a, 0x03, 0x74, 0x76, 0x6c, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x03, 0x74, 0x76, 0x6c, 0x12, 0x57, 0x0a, 0x0e, 0x6c, 0x70, + 0x5f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, + 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, + 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x0c, 0x6c, 0x70, 0x54, 0x6f, 0x6b, 0x65, 0x6e, 0x50, 0x72, + 0x69, 0x63, 0x65, 0x22, 0xb7, 0x01, 0x0a, 0x17, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x50, 0x6f, + 0x6f, 0x6c, 0x53, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 0x65, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x12, + 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, + 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, + 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x09, 0x74, 0x69, 0x6d, + 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x65, 0x0a, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, + 0x64, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, + 0x69, 0x6e, 0x42, 0x30, 0xc8, 0xde, 0x1f, 0x00, 0xaa, 0xdf, 0x1f, 0x28, 0x67, 0x69, 0x74, 0x68, + 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x74, 0x79, 0x70, 0x65, 0x73, 0x2e, 0x43, + 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x42, 0x85, 0x01, + 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x42, 0x09, + 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, + 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, + 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, + 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0xa2, 0x02, 0x03, 0x45, 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, + 0x6c, 0x79, 0x73, 0x2e, 0x41, 0x6d, 0x6d, 0xca, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, + 0x6d, 0x6d, 0xe2, 0x02, 0x14, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, + 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, + 0x3a, 0x3a, 0x41, 0x6d, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( @@ -3262,17 +3261,16 @@ var file_elys_amm_pool_proto_goTypes = []interface{}{ (*OraclePoolSlippageTrack)(nil), // 3: elys.amm.OraclePoolSlippageTrack (*LegacyPoolParams)(nil), // 4: elys.amm.LegacyPoolParams (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin - (*LegacyPoolAsset)(nil), // 6: elys.amm.LegacyPoolAsset + (*PoolAsset)(nil), // 6: elys.amm.PoolAsset (*PoolParams)(nil), // 7: elys.amm.PoolParams - (*PoolAsset)(nil), // 8: elys.amm.PoolAsset } var file_elys_amm_pool_proto_depIdxs = []int32{ 4, // 0: elys.amm.LegacyPool.pool_params:type_name -> elys.amm.LegacyPoolParams 5, // 1: elys.amm.LegacyPool.total_shares:type_name -> cosmos.base.v1beta1.Coin - 6, // 2: elys.amm.LegacyPool.pool_assets:type_name -> elys.amm.LegacyPoolAsset + 6, // 2: elys.amm.LegacyPool.pool_assets:type_name -> elys.amm.PoolAsset 7, // 3: elys.amm.Pool.pool_params:type_name -> elys.amm.PoolParams 5, // 4: elys.amm.Pool.total_shares:type_name -> cosmos.base.v1beta1.Coin - 8, // 5: elys.amm.Pool.pool_assets:type_name -> elys.amm.PoolAsset + 6, // 5: elys.amm.Pool.pool_assets:type_name -> elys.amm.PoolAsset 5, // 6: elys.amm.OraclePoolSlippageTrack.tracked:type_name -> cosmos.base.v1beta1.Coin 7, // [7:7] is the sub-list for method output_type 7, // [7:7] is the sub-list for method input_type diff --git a/api/elys/amm/pool_params.pulsar.go b/api/elys/amm/pool_params.pulsar.go index e2a5ebe99..85e8c8eff 100644 --- a/api/elys/amm/pool_params.pulsar.go +++ b/api/elys/amm/pool_params.pulsar.go @@ -21,7 +21,6 @@ var ( fd_LegacyPoolParams_use_oracle protoreflect.FieldDescriptor fd_LegacyPoolParams_weight_breaking_fee_multiplier protoreflect.FieldDescriptor fd_LegacyPoolParams_weight_breaking_fee_exponent protoreflect.FieldDescriptor - fd_LegacyPoolParams_external_liquidity_ratio protoreflect.FieldDescriptor fd_LegacyPoolParams_weight_recovery_fee_portion protoreflect.FieldDescriptor fd_LegacyPoolParams_threshold_weight_difference protoreflect.FieldDescriptor fd_LegacyPoolParams_weight_breaking_fee_portion protoreflect.FieldDescriptor @@ -36,7 +35,6 @@ func init() { fd_LegacyPoolParams_use_oracle = md_LegacyPoolParams.Fields().ByName("use_oracle") fd_LegacyPoolParams_weight_breaking_fee_multiplier = md_LegacyPoolParams.Fields().ByName("weight_breaking_fee_multiplier") fd_LegacyPoolParams_weight_breaking_fee_exponent = md_LegacyPoolParams.Fields().ByName("weight_breaking_fee_exponent") - fd_LegacyPoolParams_external_liquidity_ratio = md_LegacyPoolParams.Fields().ByName("external_liquidity_ratio") fd_LegacyPoolParams_weight_recovery_fee_portion = md_LegacyPoolParams.Fields().ByName("weight_recovery_fee_portion") fd_LegacyPoolParams_threshold_weight_difference = md_LegacyPoolParams.Fields().ByName("threshold_weight_difference") fd_LegacyPoolParams_weight_breaking_fee_portion = md_LegacyPoolParams.Fields().ByName("weight_breaking_fee_portion") @@ -138,12 +136,6 @@ func (x *fastReflection_LegacyPoolParams) Range(f func(protoreflect.FieldDescrip return } } - if x.ExternalLiquidityRatio != "" { - value := protoreflect.ValueOfString(x.ExternalLiquidityRatio) - if !f(fd_LegacyPoolParams_external_liquidity_ratio, value) { - return - } - } if x.WeightRecoveryFeePortion != "" { value := protoreflect.ValueOfString(x.WeightRecoveryFeePortion) if !f(fd_LegacyPoolParams_weight_recovery_fee_portion, value) { @@ -193,8 +185,6 @@ func (x *fastReflection_LegacyPoolParams) Has(fd protoreflect.FieldDescriptor) b return x.WeightBreakingFeeMultiplier != "" case "elys.amm.LegacyPoolParams.weight_breaking_fee_exponent": return x.WeightBreakingFeeExponent != "" - case "elys.amm.LegacyPoolParams.external_liquidity_ratio": - return x.ExternalLiquidityRatio != "" case "elys.amm.LegacyPoolParams.weight_recovery_fee_portion": return x.WeightRecoveryFeePortion != "" case "elys.amm.LegacyPoolParams.threshold_weight_difference": @@ -229,8 +219,6 @@ func (x *fastReflection_LegacyPoolParams) Clear(fd protoreflect.FieldDescriptor) x.WeightBreakingFeeMultiplier = "" case "elys.amm.LegacyPoolParams.weight_breaking_fee_exponent": x.WeightBreakingFeeExponent = "" - case "elys.amm.LegacyPoolParams.external_liquidity_ratio": - x.ExternalLiquidityRatio = "" case "elys.amm.LegacyPoolParams.weight_recovery_fee_portion": x.WeightRecoveryFeePortion = "" case "elys.amm.LegacyPoolParams.threshold_weight_difference": @@ -270,9 +258,6 @@ func (x *fastReflection_LegacyPoolParams) Get(descriptor protoreflect.FieldDescr case "elys.amm.LegacyPoolParams.weight_breaking_fee_exponent": value := x.WeightBreakingFeeExponent return protoreflect.ValueOfString(value) - case "elys.amm.LegacyPoolParams.external_liquidity_ratio": - value := x.ExternalLiquidityRatio - return protoreflect.ValueOfString(value) case "elys.amm.LegacyPoolParams.weight_recovery_fee_portion": value := x.WeightRecoveryFeePortion return protoreflect.ValueOfString(value) @@ -315,8 +300,6 @@ func (x *fastReflection_LegacyPoolParams) Set(fd protoreflect.FieldDescriptor, v x.WeightBreakingFeeMultiplier = value.Interface().(string) case "elys.amm.LegacyPoolParams.weight_breaking_fee_exponent": x.WeightBreakingFeeExponent = value.Interface().(string) - case "elys.amm.LegacyPoolParams.external_liquidity_ratio": - x.ExternalLiquidityRatio = value.Interface().(string) case "elys.amm.LegacyPoolParams.weight_recovery_fee_portion": x.WeightRecoveryFeePortion = value.Interface().(string) case "elys.amm.LegacyPoolParams.threshold_weight_difference": @@ -355,8 +338,6 @@ func (x *fastReflection_LegacyPoolParams) Mutable(fd protoreflect.FieldDescripto panic(fmt.Errorf("field weight_breaking_fee_multiplier of message elys.amm.LegacyPoolParams is not mutable")) case "elys.amm.LegacyPoolParams.weight_breaking_fee_exponent": panic(fmt.Errorf("field weight_breaking_fee_exponent of message elys.amm.LegacyPoolParams is not mutable")) - case "elys.amm.LegacyPoolParams.external_liquidity_ratio": - panic(fmt.Errorf("field external_liquidity_ratio of message elys.amm.LegacyPoolParams is not mutable")) case "elys.amm.LegacyPoolParams.weight_recovery_fee_portion": panic(fmt.Errorf("field weight_recovery_fee_portion of message elys.amm.LegacyPoolParams is not mutable")) case "elys.amm.LegacyPoolParams.threshold_weight_difference": @@ -388,8 +369,6 @@ func (x *fastReflection_LegacyPoolParams) NewField(fd protoreflect.FieldDescript return protoreflect.ValueOfString("") case "elys.amm.LegacyPoolParams.weight_breaking_fee_exponent": return protoreflect.ValueOfString("") - case "elys.amm.LegacyPoolParams.external_liquidity_ratio": - return protoreflect.ValueOfString("") case "elys.amm.LegacyPoolParams.weight_recovery_fee_portion": return protoreflect.ValueOfString("") case "elys.amm.LegacyPoolParams.threshold_weight_difference": @@ -486,10 +465,6 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.ExternalLiquidityRatio) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } l = len(x.WeightRecoveryFeePortion) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -540,34 +515,27 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.FeeDenom) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FeeDenom))) i-- - dAtA[i] = 0x52 + dAtA[i] = 0x4a } if len(x.WeightBreakingFeePortion) > 0 { i -= len(x.WeightBreakingFeePortion) copy(dAtA[i:], x.WeightBreakingFeePortion) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeePortion))) i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 } if len(x.ThresholdWeightDifference) > 0 { i -= len(x.ThresholdWeightDifference) copy(dAtA[i:], x.ThresholdWeightDifference) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ThresholdWeightDifference))) i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a } if len(x.WeightRecoveryFeePortion) > 0 { i -= len(x.WeightRecoveryFeePortion) copy(dAtA[i:], x.WeightRecoveryFeePortion) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightRecoveryFeePortion))) i-- - dAtA[i] = 0x3a - } - if len(x.ExternalLiquidityRatio) > 0 { - i -= len(x.ExternalLiquidityRatio) - copy(dAtA[i:], x.ExternalLiquidityRatio) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ExternalLiquidityRatio))) - i-- dAtA[i] = 0x32 } if len(x.WeightBreakingFeeExponent) > 0 { @@ -806,38 +774,6 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { x.WeightBreakingFeeExponent = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ExternalLiquidityRatio", 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.ExternalLiquidityRatio = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightRecoveryFeePortion", wireType) } @@ -869,7 +805,7 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { } x.WeightRecoveryFeePortion = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ThresholdWeightDifference", wireType) } @@ -901,7 +837,7 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { } x.ThresholdWeightDifference = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeePortion", wireType) } @@ -933,7 +869,7 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { } x.WeightBreakingFeePortion = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 10: + case 9: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) } @@ -1001,29 +937,17 @@ func (x *fastReflection_LegacyPoolParams) ProtoMethods() *protoiface.Methods { } var ( - md_PoolParams protoreflect.MessageDescriptor - fd_PoolParams_swap_fee protoreflect.FieldDescriptor - fd_PoolParams_exit_fee protoreflect.FieldDescriptor - fd_PoolParams_use_oracle protoreflect.FieldDescriptor - fd_PoolParams_weight_breaking_fee_multiplier protoreflect.FieldDescriptor - fd_PoolParams_weight_breaking_fee_exponent protoreflect.FieldDescriptor - fd_PoolParams_weight_recovery_fee_portion protoreflect.FieldDescriptor - fd_PoolParams_threshold_weight_difference protoreflect.FieldDescriptor - fd_PoolParams_weight_breaking_fee_portion protoreflect.FieldDescriptor - fd_PoolParams_fee_denom protoreflect.FieldDescriptor + md_PoolParams protoreflect.MessageDescriptor + fd_PoolParams_swap_fee protoreflect.FieldDescriptor + fd_PoolParams_use_oracle protoreflect.FieldDescriptor + fd_PoolParams_fee_denom protoreflect.FieldDescriptor ) func init() { file_elys_amm_pool_params_proto_init() md_PoolParams = File_elys_amm_pool_params_proto.Messages().ByName("PoolParams") fd_PoolParams_swap_fee = md_PoolParams.Fields().ByName("swap_fee") - fd_PoolParams_exit_fee = md_PoolParams.Fields().ByName("exit_fee") fd_PoolParams_use_oracle = md_PoolParams.Fields().ByName("use_oracle") - fd_PoolParams_weight_breaking_fee_multiplier = md_PoolParams.Fields().ByName("weight_breaking_fee_multiplier") - fd_PoolParams_weight_breaking_fee_exponent = md_PoolParams.Fields().ByName("weight_breaking_fee_exponent") - fd_PoolParams_weight_recovery_fee_portion = md_PoolParams.Fields().ByName("weight_recovery_fee_portion") - fd_PoolParams_threshold_weight_difference = md_PoolParams.Fields().ByName("threshold_weight_difference") - fd_PoolParams_weight_breaking_fee_portion = md_PoolParams.Fields().ByName("weight_breaking_fee_portion") fd_PoolParams_fee_denom = md_PoolParams.Fields().ByName("fee_denom") } @@ -1098,48 +1022,12 @@ func (x *fastReflection_PoolParams) Range(f func(protoreflect.FieldDescriptor, p return } } - if x.ExitFee != "" { - value := protoreflect.ValueOfString(x.ExitFee) - if !f(fd_PoolParams_exit_fee, value) { - return - } - } if x.UseOracle != false { value := protoreflect.ValueOfBool(x.UseOracle) if !f(fd_PoolParams_use_oracle, value) { return } } - if x.WeightBreakingFeeMultiplier != "" { - value := protoreflect.ValueOfString(x.WeightBreakingFeeMultiplier) - if !f(fd_PoolParams_weight_breaking_fee_multiplier, value) { - return - } - } - if x.WeightBreakingFeeExponent != "" { - value := protoreflect.ValueOfString(x.WeightBreakingFeeExponent) - if !f(fd_PoolParams_weight_breaking_fee_exponent, value) { - return - } - } - if x.WeightRecoveryFeePortion != "" { - value := protoreflect.ValueOfString(x.WeightRecoveryFeePortion) - if !f(fd_PoolParams_weight_recovery_fee_portion, value) { - return - } - } - if x.ThresholdWeightDifference != "" { - value := protoreflect.ValueOfString(x.ThresholdWeightDifference) - if !f(fd_PoolParams_threshold_weight_difference, value) { - return - } - } - if x.WeightBreakingFeePortion != "" { - value := protoreflect.ValueOfString(x.WeightBreakingFeePortion) - if !f(fd_PoolParams_weight_breaking_fee_portion, value) { - return - } - } if x.FeeDenom != "" { value := protoreflect.ValueOfString(x.FeeDenom) if !f(fd_PoolParams_fee_denom, value) { @@ -1163,20 +1051,8 @@ func (x *fastReflection_PoolParams) Has(fd protoreflect.FieldDescriptor) bool { switch fd.FullName() { case "elys.amm.PoolParams.swap_fee": return x.SwapFee != "" - case "elys.amm.PoolParams.exit_fee": - return x.ExitFee != "" case "elys.amm.PoolParams.use_oracle": return x.UseOracle != false - case "elys.amm.PoolParams.weight_breaking_fee_multiplier": - return x.WeightBreakingFeeMultiplier != "" - case "elys.amm.PoolParams.weight_breaking_fee_exponent": - return x.WeightBreakingFeeExponent != "" - case "elys.amm.PoolParams.weight_recovery_fee_portion": - return x.WeightRecoveryFeePortion != "" - case "elys.amm.PoolParams.threshold_weight_difference": - return x.ThresholdWeightDifference != "" - case "elys.amm.PoolParams.weight_breaking_fee_portion": - return x.WeightBreakingFeePortion != "" case "elys.amm.PoolParams.fee_denom": return x.FeeDenom != "" default: @@ -1197,20 +1073,8 @@ func (x *fastReflection_PoolParams) Clear(fd protoreflect.FieldDescriptor) { switch fd.FullName() { case "elys.amm.PoolParams.swap_fee": x.SwapFee = "" - case "elys.amm.PoolParams.exit_fee": - x.ExitFee = "" case "elys.amm.PoolParams.use_oracle": x.UseOracle = false - case "elys.amm.PoolParams.weight_breaking_fee_multiplier": - x.WeightBreakingFeeMultiplier = "" - case "elys.amm.PoolParams.weight_breaking_fee_exponent": - x.WeightBreakingFeeExponent = "" - case "elys.amm.PoolParams.weight_recovery_fee_portion": - x.WeightRecoveryFeePortion = "" - case "elys.amm.PoolParams.threshold_weight_difference": - x.ThresholdWeightDifference = "" - case "elys.amm.PoolParams.weight_breaking_fee_portion": - x.WeightBreakingFeePortion = "" case "elys.amm.PoolParams.fee_denom": x.FeeDenom = "" default: @@ -1232,27 +1096,9 @@ func (x *fastReflection_PoolParams) Get(descriptor protoreflect.FieldDescriptor) case "elys.amm.PoolParams.swap_fee": value := x.SwapFee return protoreflect.ValueOfString(value) - case "elys.amm.PoolParams.exit_fee": - value := x.ExitFee - return protoreflect.ValueOfString(value) case "elys.amm.PoolParams.use_oracle": value := x.UseOracle return protoreflect.ValueOfBool(value) - case "elys.amm.PoolParams.weight_breaking_fee_multiplier": - value := x.WeightBreakingFeeMultiplier - return protoreflect.ValueOfString(value) - case "elys.amm.PoolParams.weight_breaking_fee_exponent": - value := x.WeightBreakingFeeExponent - return protoreflect.ValueOfString(value) - case "elys.amm.PoolParams.weight_recovery_fee_portion": - value := x.WeightRecoveryFeePortion - return protoreflect.ValueOfString(value) - case "elys.amm.PoolParams.threshold_weight_difference": - value := x.ThresholdWeightDifference - return protoreflect.ValueOfString(value) - case "elys.amm.PoolParams.weight_breaking_fee_portion": - value := x.WeightBreakingFeePortion - return protoreflect.ValueOfString(value) case "elys.amm.PoolParams.fee_denom": value := x.FeeDenom return protoreflect.ValueOfString(value) @@ -1278,20 +1124,8 @@ func (x *fastReflection_PoolParams) Set(fd protoreflect.FieldDescriptor, value p switch fd.FullName() { case "elys.amm.PoolParams.swap_fee": x.SwapFee = value.Interface().(string) - case "elys.amm.PoolParams.exit_fee": - x.ExitFee = value.Interface().(string) case "elys.amm.PoolParams.use_oracle": x.UseOracle = value.Bool() - case "elys.amm.PoolParams.weight_breaking_fee_multiplier": - x.WeightBreakingFeeMultiplier = value.Interface().(string) - case "elys.amm.PoolParams.weight_breaking_fee_exponent": - x.WeightBreakingFeeExponent = value.Interface().(string) - case "elys.amm.PoolParams.weight_recovery_fee_portion": - x.WeightRecoveryFeePortion = value.Interface().(string) - case "elys.amm.PoolParams.threshold_weight_difference": - x.ThresholdWeightDifference = value.Interface().(string) - case "elys.amm.PoolParams.weight_breaking_fee_portion": - x.WeightBreakingFeePortion = value.Interface().(string) case "elys.amm.PoolParams.fee_denom": x.FeeDenom = value.Interface().(string) default: @@ -1316,20 +1150,8 @@ func (x *fastReflection_PoolParams) Mutable(fd protoreflect.FieldDescriptor) pro switch fd.FullName() { case "elys.amm.PoolParams.swap_fee": panic(fmt.Errorf("field swap_fee of message elys.amm.PoolParams is not mutable")) - case "elys.amm.PoolParams.exit_fee": - panic(fmt.Errorf("field exit_fee of message elys.amm.PoolParams is not mutable")) case "elys.amm.PoolParams.use_oracle": panic(fmt.Errorf("field use_oracle of message elys.amm.PoolParams is not mutable")) - case "elys.amm.PoolParams.weight_breaking_fee_multiplier": - panic(fmt.Errorf("field weight_breaking_fee_multiplier of message elys.amm.PoolParams is not mutable")) - case "elys.amm.PoolParams.weight_breaking_fee_exponent": - panic(fmt.Errorf("field weight_breaking_fee_exponent of message elys.amm.PoolParams is not mutable")) - case "elys.amm.PoolParams.weight_recovery_fee_portion": - panic(fmt.Errorf("field weight_recovery_fee_portion of message elys.amm.PoolParams is not mutable")) - case "elys.amm.PoolParams.threshold_weight_difference": - panic(fmt.Errorf("field threshold_weight_difference of message elys.amm.PoolParams is not mutable")) - case "elys.amm.PoolParams.weight_breaking_fee_portion": - panic(fmt.Errorf("field weight_breaking_fee_portion of message elys.amm.PoolParams is not mutable")) case "elys.amm.PoolParams.fee_denom": panic(fmt.Errorf("field fee_denom of message elys.amm.PoolParams is not mutable")) default: @@ -1347,20 +1169,8 @@ func (x *fastReflection_PoolParams) NewField(fd protoreflect.FieldDescriptor) pr switch fd.FullName() { case "elys.amm.PoolParams.swap_fee": return protoreflect.ValueOfString("") - case "elys.amm.PoolParams.exit_fee": - return protoreflect.ValueOfString("") case "elys.amm.PoolParams.use_oracle": return protoreflect.ValueOfBool(false) - case "elys.amm.PoolParams.weight_breaking_fee_multiplier": - return protoreflect.ValueOfString("") - case "elys.amm.PoolParams.weight_breaking_fee_exponent": - return protoreflect.ValueOfString("") - case "elys.amm.PoolParams.weight_recovery_fee_portion": - return protoreflect.ValueOfString("") - case "elys.amm.PoolParams.threshold_weight_difference": - return protoreflect.ValueOfString("") - case "elys.amm.PoolParams.weight_breaking_fee_portion": - return protoreflect.ValueOfString("") case "elys.amm.PoolParams.fee_denom": return protoreflect.ValueOfString("") default: @@ -1436,33 +1246,9 @@ func (x *fastReflection_PoolParams) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } - l = len(x.ExitFee) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } if x.UseOracle { n += 2 } - l = len(x.WeightBreakingFeeMultiplier) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.WeightBreakingFeeExponent) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.WeightRecoveryFeePortion) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.ThresholdWeightDifference) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } - l = len(x.WeightBreakingFeePortion) - if l > 0 { - n += 1 + l + runtime.Sov(uint64(l)) - } l = len(x.FeeDenom) if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) @@ -1501,42 +1287,7 @@ func (x *fastReflection_PoolParams) ProtoMethods() *protoiface.Methods { copy(dAtA[i:], x.FeeDenom) i = runtime.EncodeVarint(dAtA, i, uint64(len(x.FeeDenom))) i-- - dAtA[i] = 0x4a - } - if len(x.WeightBreakingFeePortion) > 0 { - i -= len(x.WeightBreakingFeePortion) - copy(dAtA[i:], x.WeightBreakingFeePortion) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeePortion))) - i-- - dAtA[i] = 0x42 - } - if len(x.ThresholdWeightDifference) > 0 { - i -= len(x.ThresholdWeightDifference) - copy(dAtA[i:], x.ThresholdWeightDifference) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ThresholdWeightDifference))) - i-- - dAtA[i] = 0x3a - } - if len(x.WeightRecoveryFeePortion) > 0 { - i -= len(x.WeightRecoveryFeePortion) - copy(dAtA[i:], x.WeightRecoveryFeePortion) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightRecoveryFeePortion))) - i-- - dAtA[i] = 0x32 - } - if len(x.WeightBreakingFeeExponent) > 0 { - i -= len(x.WeightBreakingFeeExponent) - copy(dAtA[i:], x.WeightBreakingFeeExponent) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeeExponent))) - i-- - dAtA[i] = 0x2a - } - if len(x.WeightBreakingFeeMultiplier) > 0 { - i -= len(x.WeightBreakingFeeMultiplier) - copy(dAtA[i:], x.WeightBreakingFeeMultiplier) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.WeightBreakingFeeMultiplier))) - i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } if x.UseOracle { i-- @@ -1546,14 +1297,7 @@ func (x *fastReflection_PoolParams) ProtoMethods() *protoiface.Methods { dAtA[i] = 0 } i-- - dAtA[i] = 0x18 - } - if len(x.ExitFee) > 0 { - i -= len(x.ExitFee) - copy(dAtA[i:], x.ExitFee) - i = runtime.EncodeVarint(dAtA, i, uint64(len(x.ExitFee))) - i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } if len(x.SwapFee) > 0 { i -= len(x.SwapFee) @@ -1644,38 +1388,6 @@ func (x *fastReflection_PoolParams) ProtoMethods() *protoiface.Methods { x.SwapFee = 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 ExitFee", 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.ExitFee = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 0 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field UseOracle", wireType) } @@ -1695,167 +1407,7 @@ func (x *fastReflection_PoolParams) ProtoMethods() *protoiface.Methods { } } x.UseOracle = bool(v != 0) - case 4: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeMultiplier", 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.WeightBreakingFeeMultiplier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeExponent", 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.WeightBreakingFeeExponent = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightRecoveryFeePortion", 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.WeightRecoveryFeePortion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 7: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field ThresholdWeightDifference", 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.ThresholdWeightDifference = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeePortion", 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.WeightBreakingFeePortion = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 9: + case 3: if wireType != 2 { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) } @@ -1945,11 +1497,10 @@ type LegacyPoolParams struct { UseOracle bool `protobuf:"varint,3,opt,name=use_oracle,json=useOracle,proto3" json:"use_oracle,omitempty"` WeightBreakingFeeMultiplier string `protobuf:"bytes,4,opt,name=weight_breaking_fee_multiplier,json=weightBreakingFeeMultiplier,proto3" json:"weight_breaking_fee_multiplier,omitempty"` WeightBreakingFeeExponent string `protobuf:"bytes,5,opt,name=weight_breaking_fee_exponent,json=weightBreakingFeeExponent,proto3" json:"weight_breaking_fee_exponent,omitempty"` - ExternalLiquidityRatio string `protobuf:"bytes,6,opt,name=external_liquidity_ratio,json=externalLiquidityRatio,proto3" json:"external_liquidity_ratio,omitempty"` - WeightRecoveryFeePortion string `protobuf:"bytes,7,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3" json:"weight_recovery_fee_portion,omitempty"` - ThresholdWeightDifference string `protobuf:"bytes,8,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3" json:"threshold_weight_difference,omitempty"` - WeightBreakingFeePortion string `protobuf:"bytes,9,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3" json:"weight_breaking_fee_portion,omitempty"` - FeeDenom string `protobuf:"bytes,10,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` // denom for fee collection + WeightRecoveryFeePortion string `protobuf:"bytes,6,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3" json:"weight_recovery_fee_portion,omitempty"` + ThresholdWeightDifference string `protobuf:"bytes,7,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3" json:"threshold_weight_difference,omitempty"` + WeightBreakingFeePortion string `protobuf:"bytes,8,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3" json:"weight_breaking_fee_portion,omitempty"` + FeeDenom string `protobuf:"bytes,9,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` // denom for fee collection } func (x *LegacyPoolParams) Reset() { @@ -2007,13 +1558,6 @@ func (x *LegacyPoolParams) GetWeightBreakingFeeExponent() string { return "" } -func (x *LegacyPoolParams) GetExternalLiquidityRatio() string { - if x != nil { - return x.ExternalLiquidityRatio - } - return "" -} - func (x *LegacyPoolParams) GetWeightRecoveryFeePortion() string { if x != nil { return x.WeightRecoveryFeePortion @@ -2047,15 +1591,9 @@ type PoolParams struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - SwapFee string `protobuf:"bytes,1,opt,name=swap_fee,json=swapFee,proto3" json:"swap_fee,omitempty"` - ExitFee string `protobuf:"bytes,2,opt,name=exit_fee,json=exitFee,proto3" json:"exit_fee,omitempty"` - UseOracle bool `protobuf:"varint,3,opt,name=use_oracle,json=useOracle,proto3" json:"use_oracle,omitempty"` - WeightBreakingFeeMultiplier string `protobuf:"bytes,4,opt,name=weight_breaking_fee_multiplier,json=weightBreakingFeeMultiplier,proto3" json:"weight_breaking_fee_multiplier,omitempty"` - WeightBreakingFeeExponent string `protobuf:"bytes,5,opt,name=weight_breaking_fee_exponent,json=weightBreakingFeeExponent,proto3" json:"weight_breaking_fee_exponent,omitempty"` - WeightRecoveryFeePortion string `protobuf:"bytes,6,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3" json:"weight_recovery_fee_portion,omitempty"` - ThresholdWeightDifference string `protobuf:"bytes,7,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3" json:"threshold_weight_difference,omitempty"` - WeightBreakingFeePortion string `protobuf:"bytes,8,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3" json:"weight_breaking_fee_portion,omitempty"` - FeeDenom string `protobuf:"bytes,9,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` // denom for fee collection + SwapFee string `protobuf:"bytes,1,opt,name=swap_fee,json=swapFee,proto3" json:"swap_fee,omitempty"` + UseOracle bool `protobuf:"varint,2,opt,name=use_oracle,json=useOracle,proto3" json:"use_oracle,omitempty"` + FeeDenom string `protobuf:"bytes,3,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` // denom for fee collection } func (x *PoolParams) Reset() { @@ -2085,13 +1623,6 @@ func (x *PoolParams) GetSwapFee() string { return "" } -func (x *PoolParams) GetExitFee() string { - if x != nil { - return x.ExitFee - } - return "" -} - func (x *PoolParams) GetUseOracle() bool { if x != nil { return x.UseOracle @@ -2099,41 +1630,6 @@ func (x *PoolParams) GetUseOracle() bool { return false } -func (x *PoolParams) GetWeightBreakingFeeMultiplier() string { - if x != nil { - return x.WeightBreakingFeeMultiplier - } - return "" -} - -func (x *PoolParams) GetWeightBreakingFeeExponent() string { - if x != nil { - return x.WeightBreakingFeeExponent - } - return "" -} - -func (x *PoolParams) GetWeightRecoveryFeePortion() string { - if x != nil { - return x.WeightRecoveryFeePortion - } - return "" -} - -func (x *PoolParams) GetThresholdWeightDifference() string { - if x != nil { - return x.ThresholdWeightDifference - } - return "" -} - -func (x *PoolParams) GetWeightBreakingFeePortion() string { - if x != nil { - return x.WeightBreakingFeePortion - } - return "" -} - func (x *PoolParams) GetFeeDenom() string { if x != nil { return x.FeeDenom @@ -2149,7 +1645,7 @@ var file_elys_amm_pool_params_proto_rawDesc = []byte{ 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x1a, 0x14, 0x67, 0x6f, 0x67, 0x6f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x67, 0x6f, 0x67, 0x6f, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9a, 0x07, 0x0a, 0x10, 0x4c, 0x65, 0x67, 0x61, + 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xad, 0x06, 0x0a, 0x10, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, @@ -2177,97 +1673,49 @@ var file_elys_amm_pool_params_proto_rawDesc = []byte{ 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x65, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x6e, - 0x65, 0x6e, 0x74, 0x12, 0x6b, 0x0a, 0x18, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, - 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x5f, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x18, - 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x16, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x61, 0x74, 0x69, 0x6f, - 0x12, 0x70, 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, - 0x65, 0x72, 0x79, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x18, - 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x18, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x69, - 0x6f, 0x6e, 0x12, 0x71, 0x0a, 0x1b, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x5f, - 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, - 0x65, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, - 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, - 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x74, 0x68, 0x72, 0x65, - 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, 0x66, 0x66, 0x65, - 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x70, 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, - 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x6f, 0x72, - 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, + 0x65, 0x6e, 0x74, 0x12, 0x70, 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x72, 0x65, + 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x69, + 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, + 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, + 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x18, 0x77, 0x65, 0x69, + 0x67, 0x68, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x46, 0x65, 0x65, 0x50, 0x6f, + 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x71, 0x0a, 0x1b, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, + 0x6c, 0x64, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, + 0x65, 0x6e, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x18, 0x77, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x65, 0x65, - 0x50, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x5f, 0x64, - 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x65, 0x65, 0x44, - 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0xa7, 0x06, 0x0a, 0x0a, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, 0x77, 0x61, 0x70, 0x46, 0x65, - 0x65, 0x12, 0x4c, 0x0a, 0x08, 0x65, 0x78, 0x69, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, - 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x65, 0x78, 0x69, 0x74, 0x46, 0x65, 0x65, 0x12, - 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x18, 0x03, 0x20, - 0x01, 0x28, 0x08, 0x52, 0x09, 0x75, 0x73, 0x65, 0x4f, 0x72, 0x61, 0x63, 0x6c, 0x65, 0x12, 0x76, - 0x0a, 0x1e, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, - 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x6d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, - 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, - 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, - 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x65, 0x65, 0x4d, 0x75, 0x6c, 0x74, - 0x69, 0x70, 0x6c, 0x69, 0x65, 0x72, 0x12, 0x72, 0x0a, 0x1c, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x65, 0x78, - 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, - 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, - 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, - 0x19, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, - 0x65, 0x65, 0x45, 0x78, 0x70, 0x6f, 0x6e, 0x65, 0x6e, 0x74, 0x12, 0x70, 0x0a, 0x1b, 0x77, 0x65, - 0x69, 0x67, 0x68, 0x74, 0x5f, 0x72, 0x65, 0x63, 0x6f, 0x76, 0x65, 0x72, 0x79, 0x5f, 0x66, 0x65, - 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, - 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, - 0x65, 0x63, 0x52, 0x18, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x52, 0x65, 0x63, 0x6f, 0x76, 0x65, - 0x72, 0x79, 0x46, 0x65, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x71, 0x0a, 0x1b, - 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x5f, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, - 0x5f, 0x64, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x74, 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x57, - 0x65, 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, - 0x70, 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, - 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, - 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x18, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, - 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x46, 0x65, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x69, 0x6f, - 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x09, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x65, 0x65, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x42, 0x8b, - 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x42, - 0x0f, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, 0x74, 0x6f, - 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, - 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, - 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0xa2, 0x02, 0x03, - 0x45, 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x41, 0x6d, 0x6d, 0xca, 0x02, - 0x08, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0xe2, 0x02, 0x14, 0x45, 0x6c, 0x79, 0x73, - 0x5c, 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, - 0xea, 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x41, 0x6d, 0x6d, 0x62, 0x06, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x33, + 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x19, 0x74, + 0x68, 0x72, 0x65, 0x73, 0x68, 0x6f, 0x6c, 0x64, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x44, 0x69, + 0x66, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x12, 0x70, 0x0a, 0x1b, 0x77, 0x65, 0x69, 0x67, + 0x68, 0x74, 0x5f, 0x62, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x5f, 0x66, 0x65, 0x65, 0x5f, + 0x70, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, + 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, + 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, + 0x52, 0x18, 0x77, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x46, 0x65, 0x65, 0x50, 0x6f, 0x72, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x65, + 0x65, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, + 0x65, 0x65, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0x96, 0x01, 0x0a, 0x0a, 0x50, 0x6f, 0x6f, 0x6c, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x66, + 0x65, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, + 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, + 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, 0x77, 0x61, + 0x70, 0x46, 0x65, 0x65, 0x12, 0x1d, 0x0a, 0x0a, 0x75, 0x73, 0x65, 0x5f, 0x6f, 0x72, 0x61, 0x63, + 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x08, 0x52, 0x09, 0x75, 0x73, 0x65, 0x4f, 0x72, 0x61, + 0x63, 0x6c, 0x65, 0x12, 0x1b, 0x0a, 0x09, 0x66, 0x65, 0x65, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x66, 0x65, 0x65, 0x44, 0x65, 0x6e, 0x6f, 0x6d, + 0x42, 0x8b, 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, + 0x6d, 0x42, 0x0f, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x50, 0x72, 0x6f, + 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, + 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, + 0x79, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0xa2, + 0x02, 0x03, 0x45, 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x41, 0x6d, 0x6d, + 0xca, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0xe2, 0x02, 0x14, 0x45, 0x6c, + 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, + 0x74, 0x61, 0xea, 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x41, 0x6d, 0x6d, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/api/elys/amm/tx.pulsar.go b/api/elys/amm/tx.pulsar.go index cb591e88d..aed8d51a6 100644 --- a/api/elys/amm/tx.pulsar.go +++ b/api/elys/amm/tx.pulsar.go @@ -13041,343 +13041,344 @@ var file_elys_amm_tx_proto_rawDesc = []byte{ 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, 0x19, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x70, 0x72, - 0x6f, 0x74, 0x6f, 0x22, 0xd7, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, + 0x6f, 0x74, 0x6f, 0x22, 0xdd, 0x01, 0x0a, 0x0d, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x3b, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, - 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x61, 0x73, 0x73, 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, - 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, - 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, - 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, 0x3a, 0x21, 0x82, 0xe7, 0xb0, 0x2a, - 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x11, 0x61, 0x6d, 0x6d, 0x2f, - 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x3c, 0x0a, - 0x15, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, - 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0a, 0xe2, 0xde, 0x1f, 0x06, 0x50, 0x6f, 0x6f, - 0x6c, 0x49, 0x44, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x22, 0x97, 0x02, 0x0a, 0x0b, - 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x30, 0x0a, 0x06, 0x73, - 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x17, 0x0a, - 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, - 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x0e, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, - 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, - 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x0c, 0x6d, 0x61, 0x78, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x49, 0x6e, 0x12, 0x55, 0x0a, - 0x10, 0x73, 0x68, 0x61, 0x72, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6f, 0x75, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, - 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, - 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x4f, 0x75, 0x74, 0x3a, 0x1f, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, - 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, - 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0xa8, 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, - 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, - 0x10, 0x73, 0x68, 0x61, 0x72, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x6f, 0x75, - 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, - 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, - 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x73, 0x68, 0x61, 0x72, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x4f, 0x75, 0x74, 0x12, 0x3a, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x6e, - 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, - 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, - 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, - 0x22, 0xbf, 0x02, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, - 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x47, 0x0a, 0x0f, 0x6d, - 0x69, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x03, + 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x12, 0x3a, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x61, 0x73, 0x73, + 0x65, 0x74, 0x73, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x13, 0x2e, 0x65, 0x6c, 0x79, 0x73, + 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x41, 0x73, 0x73, 0x65, 0x74, 0x73, + 0x3a, 0x21, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, + 0x2a, 0x11, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, + 0x6f, 0x6f, 0x6c, 0x22, 0x3c, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x23, 0x0a, 0x07, + 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x42, 0x0a, 0xe2, + 0xde, 0x1f, 0x06, 0x50, 0x6f, 0x6f, 0x6c, 0x49, 0x44, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, + 0x64, 0x22, 0x97, 0x02, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, + 0x6c, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x45, 0x0a, 0x0e, + 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x5f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x6d, 0x69, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x73, 0x4f, 0x75, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x73, 0x68, 0x61, 0x72, 0x65, 0x5f, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, + 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0c, 0x6d, 0x61, 0x78, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 0x73, 0x49, 0x6e, 0x12, 0x55, 0x0a, 0x10, 0x73, 0x68, 0x61, 0x72, 0x65, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, + 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x3a, 0x1f, 0x82, 0xe7, 0xb0, 0x2a, + 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x61, 0x6d, 0x6d, 0x2f, + 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0xa8, 0x01, 0x0a, 0x13, + 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x73, 0x68, 0x61, 0x72, 0x65, 0x5f, 0x61, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0d, 0x73, 0x68, 0x61, 0x72, - 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x12, 0x26, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, - 0x28, 0x09, 0x52, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, 0x74, 0x44, 0x65, 0x6e, 0x6f, - 0x6d, 0x3a, 0x1f, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, - 0xb0, 0x2a, 0x0f, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, - 0x6f, 0x6c, 0x22, 0x53, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, - 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x3c, 0x0a, 0x09, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x73, 0x68, 0x61, 0x72, + 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x3a, 0x0a, 0x08, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, - 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x74, - 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, 0x74, 0x22, 0xff, 0x02, 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x53, - 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, - 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, - 0x65, 0x72, 0x12, 0x39, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, - 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, - 0x61, 0x70, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, - 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x3a, 0x0a, - 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x6e, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, - 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x07, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x12, 0x5c, 0x0a, 0x14, 0x74, 0x6f, 0x6b, - 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x69, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, - 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, - 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x11, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, 0x74, 0x4d, 0x69, - 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, - 0x69, 0x65, 0x6e, 0x74, 0x18, 0x05, 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, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x3a, - 0x28, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, - 0x18, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, - 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x22, 0xb0, 0x02, 0x0a, 0x1c, 0x4d, 0x73, - 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x55, 0x0a, 0x10, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, - 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, - 0x74, 0x52, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, - 0x74, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, - 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x12, - 0x4d, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, - 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, - 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x44, 0x65, 0x63, 0x52, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, - 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x22, 0x82, 0x03, 0x0a, - 0x15, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x74, + 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x22, 0xbf, 0x02, 0x0a, 0x0b, 0x4d, 0x73, 0x67, 0x45, 0x78, + 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x3a, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, - 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, - 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, - 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, - 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, - 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, - 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, - 0x75, 0x74, 0x12, 0x5a, 0x0a, 0x13, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x6e, 0x5f, 0x6d, - 0x61, 0x78, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, - 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, - 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, - 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x10, 0x74, 0x6f, - 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x4d, 0x61, 0x78, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, - 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x05, 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, 0x72, 0x65, 0x63, - 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x3a, 0x29, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x53, + 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, + 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, + 0x64, 0x12, 0x47, 0x0a, 0x0f, 0x6d, 0x69, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x73, + 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, + 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0d, 0x6d, 0x69, 0x6e, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x73, 0x4f, 0x75, 0x74, 0x12, 0x53, 0x0a, 0x0f, 0x73, 0x68, + 0x61, 0x72, 0x65, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x69, 0x6e, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, + 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, + 0x52, 0x0d, 0x73, 0x68, 0x61, 0x72, 0x65, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x12, + 0x26, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x64, 0x65, 0x6e, + 0x6f, 0x6d, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, + 0x75, 0x74, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x3a, 0x1f, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, + 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x0f, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, + 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x22, 0x53, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x45, + 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x3c, 0x0a, 0x09, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x01, 0x20, 0x03, + 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, + 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, + 0xde, 0x1f, 0x00, 0x52, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, 0x74, 0x22, 0xff, 0x02, + 0x0a, 0x14, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x39, 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, + 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, + 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, + 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x72, 0x6f, 0x75, + 0x74, 0x65, 0x73, 0x12, 0x3a, 0x0a, 0x08, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x6e, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, + 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, + 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x07, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x12, + 0x5c, 0x0a, 0x14, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x6d, 0x69, 0x6e, + 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, + 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, + 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x11, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x4f, 0x75, 0x74, 0x4d, 0x69, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, 0x0a, + 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x05, 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, 0x72, 0x65, 0x63, 0x69, + 0x70, 0x69, 0x65, 0x6e, 0x74, 0x3a, 0x28, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, + 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x18, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x77, + 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x22, + 0xb0, 0x02, 0x0a, 0x1c, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, + 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x55, 0x0a, 0x10, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x5f, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, + 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, + 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, + 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0e, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, + 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, + 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, + 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, 0x77, + 0x61, 0x70, 0x46, 0x65, 0x65, 0x12, 0x4d, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, + 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, + 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, + 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x08, 0x64, 0x69, 0x73, 0x63, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, + 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, + 0x6e, 0x74, 0x22, 0x82, 0x03, 0x0a, 0x15, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, + 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x30, 0x0a, 0x06, + 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x3a, + 0x0a, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, + 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x42, 0x04, 0xc8, 0xde, + 0x1f, 0x00, 0x52, 0x06, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x73, 0x12, 0x3c, 0x0a, 0x09, 0x74, 0x6f, + 0x6b, 0x65, 0x6e, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, + 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, + 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x08, + 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x4f, 0x75, 0x74, 0x12, 0x5a, 0x0a, 0x13, 0x74, 0x6f, 0x6b, 0x65, + 0x6e, 0x5f, 0x69, 0x6e, 0x5f, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, + 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, + 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, + 0x6e, 0x74, 0x52, 0x10, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x4d, 0x61, 0x78, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, + 0x74, 0x18, 0x05, 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, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x3a, 0x29, 0x82, 0xe7, + 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x19, 0x61, 0x6d, + 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x22, 0xaf, 0x02, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, - 0x74, 0x22, 0xaf, 0x02, 0x0a, 0x1d, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, - 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x5f, 0x69, 0x6e, 0x5f, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, - 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, - 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, - 0x49, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, - 0x5f, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, - 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, - 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, - 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, - 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x12, 0x4d, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, - 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, - 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x08, 0x64, 0x69, 0x73, - 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, - 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, - 0x65, 0x6e, 0x74, 0x22, 0xcb, 0x01, 0x0a, 0x20, 0x4d, 0x73, 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, - 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, - 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, - 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x3f, 0x0a, 0x09, 0x6c, 0x69, - 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, - 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, - 0x52, 0x09, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x3a, 0x34, 0x82, 0xe7, 0xb0, - 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x24, 0x61, 0x6d, 0x6d, - 0x2f, 0x4d, 0x73, 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, - 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, - 0x79, 0x22, 0x2a, 0x0a, 0x28, 0x4d, 0x73, 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, - 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, - 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xbc, 0x01, - 0x0a, 0x10, 0x41, 0x73, 0x73, 0x65, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x65, 0x70, - 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x73, 0x73, 0x65, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x05, 0x61, 0x73, 0x73, 0x65, 0x74, 0x12, 0x49, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, - 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, + 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x53, 0x0a, 0x0f, 0x74, 0x6f, 0x6b, + 0x65, 0x6e, 0x5f, 0x69, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x09, 0x42, 0x2b, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x15, 0x63, 0x6f, 0x73, 0x6d, + 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x49, 0x6e, + 0x74, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x49, 0x6e, 0x74, 0x52, + 0x0d, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x49, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x4c, + 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, + 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, + 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, + 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, + 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x12, 0x4d, 0x0a, 0x08, + 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0x52, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, + 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, + 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x22, 0xcb, 0x01, 0x0a, 0x20, 0x4d, 0x73, + 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x30, + 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, + 0x12, 0x3f, 0x0a, 0x09, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x18, 0x02, 0x20, + 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x45, + 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, + 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x6c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, + 0x79, 0x3a, 0x34, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, + 0xb0, 0x2a, 0x24, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, + 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, + 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x22, 0x2a, 0x0a, 0x28, 0x4d, 0x73, 0x67, 0x46, 0x65, + 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, + 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0xbc, 0x01, 0x0a, 0x10, 0x41, 0x73, 0x73, 0x65, 0x74, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x74, 0x68, 0x12, 0x14, 0x0a, 0x05, 0x61, 0x73, 0x73, 0x65, + 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x61, 0x73, 0x73, 0x65, 0x74, 0x12, 0x49, + 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, + 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, + 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, + 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, + 0x63, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x05, 0x64, 0x65, 0x70, + 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, - 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x06, 0x61, 0x6d, 0x6f, - 0x75, 0x6e, 0x74, 0x12, 0x47, 0x0a, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x18, 0x03, 0x20, 0x01, - 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, - 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, - 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x05, 0x64, 0x65, 0x70, 0x74, 0x68, 0x22, 0x7a, 0x0a, 0x11, - 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, - 0x79, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, - 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x4c, 0x0a, 0x11, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, - 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, - 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x74, - 0x68, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x44, - 0x65, 0x70, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x8f, 0x03, 0x0a, 0x0e, 0x4d, 0x73, 0x67, - 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x30, 0x0a, 0x06, 0x73, - 0x65, 0x6e, 0x64, 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, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, - 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, - 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, - 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, - 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x6d, 0x69, 0x6e, 0x5f, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x6d, 0x69, 0x6e, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0a, 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6d, - 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, - 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x09, 0x6d, 0x61, 0x78, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, - 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x49, - 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x06, - 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x4f, 0x75, 0x74, 0x12, 0x36, - 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, + 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x05, 0x64, 0x65, 0x70, + 0x74, 0x68, 0x22, 0x7a, 0x0a, 0x11, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, + 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, + 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, + 0x12, 0x4c, 0x0a, 0x11, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x5f, 0x64, 0x65, 0x70, 0x74, 0x68, + 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x65, 0x6c, + 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x41, 0x73, 0x73, 0x65, 0x74, 0x41, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x44, 0x65, 0x70, 0x74, 0x68, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0f, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x44, 0x65, 0x70, 0x74, 0x68, 0x49, 0x6e, 0x66, 0x6f, 0x22, 0x8f, + 0x03, 0x0a, 0x0e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, + 0x6d, 0x12, 0x30, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 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, 0x09, 0x72, 0x65, 0x63, - 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x3a, 0x22, 0x82, 0xe7, 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, - 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x53, - 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x22, 0xd1, 0x03, 0x0a, 0x16, 0x4d, - 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, - 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, - 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, - 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, - 0x0a, 0x08, 0x69, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, - 0x32, 0x1b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x07, 0x69, - 0x6e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x09, 0x6f, 0x75, 0x74, 0x5f, 0x72, 0x6f, - 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, - 0x75, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x08, 0x6f, 0x75, 0x74, 0x52, 0x6f, 0x75, 0x74, - 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x73, 0x70, 0x6f, 0x74, 0x5f, 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, - 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x09, 0x73, 0x70, 0x6f, 0x74, 0x50, 0x72, - 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, - 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, - 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, - 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, - 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, 0x73, 0x77, 0x61, 0x70, 0x46, 0x65, - 0x65, 0x12, 0x4d, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, - 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, - 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, - 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, - 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, - 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x22, 0xc9, - 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, - 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x17, - 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, - 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, - 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, - 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x2a, - 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, - 0xb0, 0x2a, 0x17, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, - 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x6d, 0x0a, 0x1b, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, - 0x6c, 0x5f, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, - 0x49, 0x64, 0x12, 0x35, 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, - 0x6d, 0x6d, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x70, - 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x0f, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x28, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, - 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, - 0x2e, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, - 0x26, 0x82, 0xe7, 0xb0, 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, - 0xe7, 0xb0, 0x2a, 0x13, 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, - 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, - 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x32, 0x89, 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x46, 0x0a, 0x0a, 0x43, 0x72, - 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, - 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, - 0x6c, 0x1a, 0x1f, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, - 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, - 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x15, - 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, - 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x1a, 0x1d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, - 0x2e, 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, - 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, 0x0a, 0x08, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, - 0x12, 0x15, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x45, - 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x1a, 0x1d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, - 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x11, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, - 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x12, 0x1e, 0x2e, 0x65, 0x6c, - 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, - 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x1a, 0x26, 0x2e, 0x65, 0x6c, - 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, - 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x5e, 0x0a, 0x12, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, - 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, - 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x1a, 0x27, 0x2e, 0x65, 0x6c, 0x79, - 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, - 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x12, 0x49, 0x0a, 0x0b, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, - 0x6f, 0x6d, 0x12, 0x18, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, - 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x1a, 0x20, 0x2e, 0x65, - 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, - 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, - 0x0a, 0x1d, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, - 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, - 0x2a, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x65, + 0x64, 0x72, 0x65, 0x73, 0x73, 0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x52, 0x06, 0x73, 0x65, 0x6e, + 0x64, 0x65, 0x72, 0x12, 0x37, 0x0a, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, + 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, + 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0a, + 0x6d, 0x69, 0x6e, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x09, 0x6d, 0x69, 0x6e, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x3e, 0x0a, 0x0a, + 0x6d, 0x61, 0x78, 0x5f, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x19, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, + 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, + 0x00, 0x52, 0x09, 0x6d, 0x61, 0x78, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x19, 0x0a, 0x08, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x5f, 0x69, 0x6e, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, + 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x49, 0x6e, 0x12, 0x1b, 0x0a, 0x09, 0x64, 0x65, 0x6e, 0x6f, 0x6d, + 0x5f, 0x6f, 0x75, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x64, 0x65, 0x6e, 0x6f, + 0x6d, 0x4f, 0x75, 0x74, 0x12, 0x36, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, + 0x74, 0x18, 0x07, 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, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, 0x65, 0x6e, 0x74, 0x3a, 0x22, 0x82, 0xe7, + 0xb0, 0x2a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x8a, 0xe7, 0xb0, 0x2a, 0x12, 0x61, 0x6d, + 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, + 0x22, 0xd1, 0x03, 0x0a, 0x16, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, + 0x6e, 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x37, 0x0a, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x19, 0x2e, 0x63, 0x6f, + 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, + 0x31, 0x2e, 0x43, 0x6f, 0x69, 0x6e, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x06, 0x61, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x36, 0x0a, 0x08, 0x69, 0x6e, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, + 0x18, 0x02, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, + 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x41, 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x6f, + 0x75, 0x74, 0x65, 0x52, 0x07, 0x69, 0x6e, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x39, 0x0a, 0x09, + 0x6f, 0x75, 0x74, 0x5f, 0x72, 0x6f, 0x75, 0x74, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x1c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x53, 0x77, 0x61, 0x70, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x52, 0x08, 0x6f, + 0x75, 0x74, 0x52, 0x6f, 0x75, 0x74, 0x65, 0x12, 0x50, 0x0a, 0x0a, 0x73, 0x70, 0x6f, 0x74, 0x5f, + 0x70, 0x72, 0x69, 0x63, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, + 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, + 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x09, + 0x73, 0x70, 0x6f, 0x74, 0x50, 0x72, 0x69, 0x63, 0x65, 0x12, 0x4c, 0x0a, 0x08, 0x73, 0x77, 0x61, + 0x70, 0x5f, 0x66, 0x65, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, + 0x00, 0xda, 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, + 0x6f, 0x2f, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, + 0xd2, 0xb4, 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x07, + 0x73, 0x77, 0x61, 0x70, 0x46, 0x65, 0x65, 0x12, 0x4d, 0x0a, 0x08, 0x64, 0x69, 0x73, 0x63, 0x6f, + 0x75, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, 0xde, 0x1f, 0x00, 0xda, + 0xde, 0x1f, 0x1b, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x73, 0x64, 0x6b, 0x2e, 0x69, 0x6f, 0x2f, + 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x4c, 0x65, 0x67, 0x61, 0x63, 0x79, 0x44, 0x65, 0x63, 0xd2, 0xb4, + 0x2d, 0x0a, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x44, 0x65, 0x63, 0x52, 0x08, 0x64, 0x69, + 0x73, 0x63, 0x6f, 0x75, 0x6e, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, 0x69, + 0x65, 0x6e, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x09, 0x72, 0x65, 0x63, 0x69, 0x70, + 0x69, 0x65, 0x6e, 0x74, 0x22, 0xcf, 0x01, 0x0a, 0x13, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, + 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x3b, 0x0a, + 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x6f, + 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x0a, + 0x70, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x2a, 0x82, 0xe7, 0xb0, 0x2a, + 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x17, 0x61, + 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x6d, 0x0a, 0x1b, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x17, 0x0a, 0x07, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x64, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x06, 0x70, 0x6f, 0x6f, 0x6c, 0x49, 0x64, 0x12, 0x35, + 0x0a, 0x0b, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x0b, 0x32, 0x14, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, + 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x0a, 0x70, 0x6f, 0x6f, 0x6c, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x22, 0x9b, 0x01, 0x0a, 0x0f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 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, 0x28, 0x0a, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x10, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x52, 0x06, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x3a, 0x26, 0x82, 0xe7, 0xb0, + 0x2a, 0x09, 0x61, 0x75, 0x74, 0x68, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x8a, 0xe7, 0xb0, 0x2a, 0x13, + 0x61, 0x6d, 0x6d, 0x2f, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, + 0x61, 0x6d, 0x73, 0x22, 0x19, 0x0a, 0x17, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0x89, + 0x06, 0x0a, 0x03, 0x4d, 0x73, 0x67, 0x12, 0x46, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, + 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x17, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, + 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x1a, 0x1f, 0x2e, + 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x40, + 0x0a, 0x08, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x15, 0x2e, 0x65, 0x6c, 0x79, + 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, + 0x6c, 0x1a, 0x1d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, + 0x4a, 0x6f, 0x69, 0x6e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x40, 0x0a, 0x08, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x12, 0x15, 0x2e, 0x65, + 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x45, 0x78, 0x69, 0x74, 0x50, + 0x6f, 0x6f, 0x6c, 0x1a, 0x1d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, + 0x73, 0x67, 0x45, 0x78, 0x69, 0x74, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x5b, 0x0a, 0x11, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x12, 0x1e, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, + 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x1a, 0x26, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, + 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 0x49, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x5e, 0x0a, 0x12, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, 0x75, + 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x12, 0x1f, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, + 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, 0x6f, + 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x1a, 0x27, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, + 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x45, 0x78, 0x61, 0x63, 0x74, 0x41, 0x6d, + 0x6f, 0x75, 0x6e, 0x74, 0x4f, 0x75, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, + 0x49, 0x0a, 0x0b, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x12, 0x18, + 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, + 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, 0x6f, 0x6d, 0x1a, 0x20, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, + 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x53, 0x77, 0x61, 0x70, 0x42, 0x79, 0x44, 0x65, 0x6e, + 0x6f, 0x6d, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x7f, 0x0a, 0x1d, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, - 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x65, 0x6c, + 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x12, 0x2a, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, - 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, - 0x58, 0x0a, 0x10, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, - 0x61, 0x6d, 0x73, 0x12, 0x1d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, - 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, - 0x6d, 0x73, 0x1a, 0x25, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, - 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, - 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0c, 0x55, 0x70, 0x64, - 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x19, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x21, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, - 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, - 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x83, - 0x01, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x42, - 0x07, 0x54, 0x78, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, - 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, - 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, 0x79, - 0x73, 0x2f, 0x61, 0x6d, 0x6d, 0xa2, 0x02, 0x03, 0x45, 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, 0x6c, - 0x79, 0x73, 0x2e, 0x41, 0x6d, 0x6d, 0xca, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, - 0x6d, 0xe2, 0x02, 0x14, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, 0x42, - 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, 0x3a, - 0x3a, 0x41, 0x6d, 0x6d, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x71, 0x75, 0x69, 0x64, 0x69, 0x74, 0x79, 0x1a, 0x32, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, + 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x46, 0x65, 0x65, 0x64, 0x4d, 0x75, 0x6c, 0x74, 0x69, 0x70, + 0x6c, 0x65, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x4c, 0x69, 0x71, 0x75, 0x69, 0x64, + 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x58, 0x0a, 0x10, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0x1d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x1a, 0x25, + 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x50, 0x6f, 0x6f, 0x6c, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x4c, 0x0a, 0x0c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, + 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x19, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, + 0x2e, 0x4d, 0x73, 0x67, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, + 0x1a, 0x21, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x2e, 0x4d, 0x73, 0x67, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x1a, 0x05, 0x80, 0xe7, 0xb0, 0x2a, 0x01, 0x42, 0x83, 0x01, 0x0a, 0x0c, 0x63, + 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x61, 0x6d, 0x6d, 0x42, 0x07, 0x54, 0x78, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x29, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, + 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x61, 0x6d, + 0x6d, 0xa2, 0x02, 0x03, 0x45, 0x41, 0x58, 0xaa, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x41, + 0x6d, 0x6d, 0xca, 0x02, 0x08, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0xe2, 0x02, 0x14, + 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x41, 0x6d, 0x6d, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, + 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x09, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x41, 0x6d, 0x6d, + 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/elys/amm/params.proto b/proto/elys/amm/params.proto index 8b4b798b0..9c6bcceca 100644 --- a/proto/elys/amm/params.proto +++ b/proto/elys/amm/params.proto @@ -7,7 +7,7 @@ import "cosmos_proto/cosmos.proto"; option go_package = "github.com/elys-network/elys/x/amm/types"; // Params defines the parameters for the module. -message Params { +message LegacyParams { string pool_creation_fee = 1 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", @@ -16,3 +16,39 @@ message Params { uint64 slippage_track_duration = 2; // default 1 week: 604,800 bool enable_base_currency_paired_pool_only = 3; } + +message Params { + string pool_creation_fee = 1 [ + (cosmos_proto.scalar) = "cosmos.Int", + (gogoproto.customtype) = "cosmossdk.io/math.Int", + (gogoproto.nullable) = false + ]; + uint64 slippage_track_duration = 2; // default 1 week: 604,800 + repeated string base_assets = 3; + string weight_breaking_fee_exponent = 4 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string weight_breaking_fee_multiplier = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string weight_breaking_fee_portion = 6 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string weight_recovery_fee_portion = 7 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + string threshold_weight_difference = 8 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; + repeated string allowed_pool_creators = 9; +} diff --git a/proto/elys/amm/pool.proto b/proto/elys/amm/pool.proto index 682239222..651a9d1b8 100644 --- a/proto/elys/amm/pool.proto +++ b/proto/elys/amm/pool.proto @@ -13,7 +13,7 @@ message LegacyPool { string address = 2; LegacyPoolParams pool_params = 3 [ (gogoproto.nullable) = false ]; cosmos.base.v1beta1.Coin total_shares = 4 [ (gogoproto.nullable) = false ]; - repeated LegacyPoolAsset pool_assets = 5 [ (gogoproto.nullable) = false ]; + repeated PoolAsset pool_assets = 5 [ (gogoproto.nullable) = false ]; string total_weight = 6 [ (cosmos_proto.scalar) = "cosmos.Int", (gogoproto.customtype) = "cosmossdk.io/math.Int", diff --git a/proto/elys/amm/pool_params.proto b/proto/elys/amm/pool_params.proto index e17536fdf..874998975 100644 --- a/proto/elys/amm/pool_params.proto +++ b/proto/elys/amm/pool_params.proto @@ -28,27 +28,22 @@ message LegacyPoolParams { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - string external_liquidity_ratio = 6 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - string weight_recovery_fee_portion = 7 [ + string weight_recovery_fee_portion = 6 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - string threshold_weight_difference = 8 [ + string threshold_weight_difference = 7 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - string weight_breaking_fee_portion = 9 [ + string weight_breaking_fee_portion = 8 [ (cosmos_proto.scalar) = "cosmos.Dec", (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - string fee_denom = 10; // denom for fee collection + string fee_denom = 9; // denom for fee collection } message PoolParams { @@ -57,36 +52,6 @@ message PoolParams { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - string exit_fee = 2 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - bool use_oracle = 3; - string weight_breaking_fee_multiplier = 4 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - string weight_breaking_fee_exponent = 5 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - string weight_recovery_fee_portion = 6 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - string threshold_weight_difference = 7 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - string weight_breaking_fee_portion = 8 [ - (cosmos_proto.scalar) = "cosmos.Dec", - (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", - (gogoproto.nullable) = false - ]; - string fee_denom = 9; // denom for fee collection + bool use_oracle = 2; + string fee_denom = 3; // denom for fee collection } diff --git a/proto/elys/amm/tx.proto b/proto/elys/amm/tx.proto index 44543c49f..093db97d8 100644 --- a/proto/elys/amm/tx.proto +++ b/proto/elys/amm/tx.proto @@ -36,7 +36,7 @@ message MsgCreatePool { option (cosmos.msg.v1.signer) = "sender"; option (amino.name) = "amm/MsgCreatePool"; string sender = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; - PoolParams pool_params = 2; + PoolParams pool_params = 2 [ (gogoproto.nullable) = false ]; repeated PoolAsset pool_assets = 3 [ (gogoproto.nullable) = false ]; } @@ -224,7 +224,7 @@ message MsgUpdatePoolParams { option (amino.name) = "amm/MsgUpdatePoolParams"; string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; uint64 pool_id = 2; - PoolParams pool_params = 3; + PoolParams pool_params = 3 [ (gogoproto.nullable) = false ]; } message MsgUpdatePoolParamsResponse { diff --git a/x/amm/client/cli/query_pool_test.go b/x/amm/client/cli/query_pool_test.go index b547414c9..baaa5a4d0 100644 --- a/x/amm/client/cli/query_pool_test.go +++ b/x/amm/client/cli/query_pool_test.go @@ -33,15 +33,9 @@ func networkWithPoolObjects(t *testing.T, n int) (*network.Network, []types.Pool TotalWeight: sdkmath.NewInt(100), Address: types.NewPoolAddress(uint64(i)).String(), PoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, } nullify.Fill(&pool) diff --git a/x/amm/client/cli/tx_create_pool.go b/x/amm/client/cli/tx_create_pool.go index 7a6b2a556..7e554468b 100644 --- a/x/amm/client/cli/tx_create_pool.go +++ b/x/amm/client/cli/tx_create_pool.go @@ -13,15 +13,9 @@ import ( ) const ( - FlagSwapFee = "swap-fee" - FlagExitFee = "exit-fee" - FlagUseOracle = "use-oracle" - FlagWeightBreakingFeeMultiplier = "weight-breaking-fee-multiplier" - FlagWeightBreakingFeeExponent = "weight-breaking-fee-exponent" - FlagWeightRecoveryFeePortion = "weight-recovery-fee-portion" - FlagWeightBreakingFeePortion = "weight-breaking-fee-portion" - FlagThresholdWeightDifference = "threshold-weight-diff" - FlagFeeDenom = "fee-denom" + FlagSwapFee = "swap-fee" + FlagUseOracle = "use-oracle" + FlagFeeDenom = "fee-denom" ) func CmdCreatePool() *cobra.Command { @@ -69,56 +63,20 @@ func CmdCreatePool() *cobra.Command { return err } - exitFeeStr, err := cmd.Flags().GetString(FlagExitFee) - if err != nil { - return err - } - useOracle, err := cmd.Flags().GetBool(FlagUseOracle) if err != nil { return err } - weightBreakingFeeMultiplierStr, err := cmd.Flags().GetString(FlagWeightBreakingFeeMultiplier) - if err != nil { - return err - } - - weightBreakingFeeExponentStr, err := cmd.Flags().GetString(FlagWeightBreakingFeeExponent) - if err != nil { - return err - } - - weightRecoveryFeePortionStr, err := cmd.Flags().GetString(FlagWeightRecoveryFeePortion) - if err != nil { - return err - } - - weightBreakingFeePortionStr, err := cmd.Flags().GetString(FlagWeightBreakingFeePortion) - if err != nil { - return err - } - - thresholdWeightDifferenceStr, err := cmd.Flags().GetString(FlagThresholdWeightDifference) - if err != nil { - return err - } - feeDenom, err := cmd.Flags().GetString(FlagFeeDenom) if err != nil { return err } - poolParams := &types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr(swapFeeStr), - ExitFee: sdkmath.LegacyMustNewDecFromStr(exitFeeStr), - UseOracle: useOracle, - WeightBreakingFeeMultiplier: sdkmath.LegacyMustNewDecFromStr(weightBreakingFeeMultiplierStr), - WeightBreakingFeeExponent: sdkmath.LegacyMustNewDecFromStr(weightBreakingFeeExponentStr), - WeightRecoveryFeePortion: sdkmath.LegacyMustNewDecFromStr(weightRecoveryFeePortionStr), - WeightBreakingFeePortion: sdkmath.LegacyMustNewDecFromStr(weightBreakingFeePortionStr), - ThresholdWeightDifference: sdkmath.LegacyMustNewDecFromStr(thresholdWeightDifferenceStr), - FeeDenom: feeDenom, + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyMustNewDecFromStr(swapFeeStr), + UseOracle: useOracle, + FeeDenom: feeDenom, } msg := types.NewMsgCreatePool( @@ -136,13 +94,7 @@ func CmdCreatePool() *cobra.Command { flags.AddTxFlagsToCmd(cmd) cmd.Flags().String(FlagSwapFee, "0.00", "swap fee") - cmd.Flags().String(FlagExitFee, "0.00", "exit fee") cmd.Flags().Bool(FlagUseOracle, false, "flag to be an oracle pool or non-oracle pool") - cmd.Flags().String(FlagWeightBreakingFeeMultiplier, "0.00", "weight breaking fee multiplier") - cmd.Flags().String(FlagWeightBreakingFeeExponent, "2.50", "weight breaking fee exponent") - cmd.Flags().String(FlagWeightRecoveryFeePortion, "0.10", "weight recovery fee portion") - cmd.Flags().String(FlagWeightBreakingFeePortion, "0.10", "weight breaking fee portion") - cmd.Flags().String(FlagThresholdWeightDifference, "0.00", "threshold weight difference - valid for oracle pool") cmd.Flags().String(FlagFeeDenom, "", "fee denom") return cmd diff --git a/x/amm/client/cli/tx_update_pool_params.go b/x/amm/client/cli/tx_update_pool_params.go index 74d549cc0..5a6f00a46 100644 --- a/x/amm/client/cli/tx_update_pool_params.go +++ b/x/amm/client/cli/tx_update_pool_params.go @@ -27,50 +27,20 @@ func CmdUpdatePoolParams() *cobra.Command { return err } - exitFeeStr, err := cmd.Flags().GetString(FlagExitFee) - if err != nil { - return err - } - useOracle, err := cmd.Flags().GetBool(FlagUseOracle) if err != nil { return err } - weightBreakingFeeMultiplierStr, err := cmd.Flags().GetString(FlagWeightBreakingFeeMultiplier) - if err != nil { - return err - } - - weightBreakingFeeExponentStr, err := cmd.Flags().GetString(FlagWeightBreakingFeeExponent) - if err != nil { - return err - } - - weightRecoveryFeePortionStr, err := cmd.Flags().GetString(FlagWeightRecoveryFeePortion) - if err != nil { - return err - } - - thresholdWeightDifferenceStr, err := cmd.Flags().GetString(FlagThresholdWeightDifference) - if err != nil { - return err - } - feeDenom, err := cmd.Flags().GetString(FlagFeeDenom) if err != nil { return err } - poolParams := &types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr(swapFeeStr), - ExitFee: sdkmath.LegacyMustNewDecFromStr(exitFeeStr), - UseOracle: useOracle, - WeightBreakingFeeMultiplier: sdkmath.LegacyMustNewDecFromStr(weightBreakingFeeMultiplierStr), - WeightBreakingFeeExponent: sdkmath.LegacyMustNewDecFromStr(weightBreakingFeeExponentStr), - WeightRecoveryFeePortion: sdkmath.LegacyMustNewDecFromStr(weightRecoveryFeePortionStr), - ThresholdWeightDifference: sdkmath.LegacyMustNewDecFromStr(thresholdWeightDifferenceStr), - FeeDenom: feeDenom, + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyMustNewDecFromStr(swapFeeStr), + UseOracle: useOracle, + FeeDenom: feeDenom, } clientCtx, err := client.GetClientTxContext(cmd) @@ -93,12 +63,7 @@ func CmdUpdatePoolParams() *cobra.Command { flags.AddTxFlagsToCmd(cmd) cmd.Flags().String(FlagSwapFee, "0.00", "swap fee") - cmd.Flags().String(FlagExitFee, "0.00", "exit fee") cmd.Flags().Bool(FlagUseOracle, false, "flag to be an oracle pool or non-oracle pool") - cmd.Flags().String(FlagWeightBreakingFeeExponent, "0.00", "weight breaking fee exponent") - cmd.Flags().String(FlagWeightBreakingFeeMultiplier, "0.00", "weight breaking fee multiplier") - cmd.Flags().String(FlagWeightRecoveryFeePortion, "0.00", "weight recovery fee portion") - cmd.Flags().String(FlagThresholdWeightDifference, "0.00", "threshold weight difference - valid for oracle pool") cmd.Flags().String(FlagFeeDenom, "", "fee denom") return cmd diff --git a/x/amm/keeper/apply_exit_pool_state_change.go b/x/amm/keeper/apply_exit_pool_state_change.go index 7088f14d8..265919fc1 100644 --- a/x/amm/keeper/apply_exit_pool_state_change.go +++ b/x/amm/keeper/apply_exit_pool_state_change.go @@ -6,32 +6,22 @@ import ( "github.com/elys-network/elys/x/amm/types" ) -func (k Keeper) ApplyExitPoolStateChange(ctx sdk.Context, pool types.Pool, exiter sdk.AccAddress, numShares sdkmath.Int, exitCoins sdk.Coins, isLiquidation bool) (sdk.Coins, error) { +func (k Keeper) ApplyExitPoolStateChange(ctx sdk.Context, pool types.Pool, exiter sdk.AccAddress, numShares sdkmath.Int, exitCoins sdk.Coins, isLiquidation bool) error { // Withdraw exit amount of token from commitment module to exiter's wallet. poolShareDenom := types.GetPoolShareDenom(pool.GetPoolId()) // Withdraw committed LP tokens err := k.commitmentKeeper.UncommitTokens(ctx, exiter, poolShareDenom, numShares, isLiquidation) if err != nil { - return sdk.Coins{}, err + return err } if err = k.bankKeeper.SendCoins(ctx, sdk.MustAccAddressFromBech32(pool.GetAddress()), exiter, exitCoins); err != nil { - return sdk.Coins{}, err - } - - exitFeeCoins := PortionCoins(exitCoins, pool.PoolParams.ExitFee) - rebalanceTreasury := sdk.MustAccAddressFromBech32(pool.GetRebalanceTreasury()) - if err = k.bankKeeper.SendCoins(ctx, exiter, rebalanceTreasury, exitFeeCoins); err != nil { - return sdk.Coins{}, err - } - - if err = k.OnCollectFee(ctx, pool, exitFeeCoins); err != nil { - return sdk.Coins{}, err + return err } if err = k.BurnPoolShareFromAccount(ctx, pool, exiter, numShares); err != nil { - return sdk.Coins{}, err + return err } k.SetPool(ctx, pool) @@ -40,8 +30,8 @@ func (k Keeper) ApplyExitPoolStateChange(ctx sdk.Context, pool types.Pool, exite if k.hooks != nil { err = k.hooks.AfterExitPool(ctx, exiter, pool, numShares, exitCoins) if err != nil { - return sdk.Coins{}, err + return err } } - return exitCoins.Sub(exitFeeCoins...), nil + return nil } diff --git a/x/amm/keeper/apply_exit_pool_state_change_test.go b/x/amm/keeper/apply_exit_pool_state_change_test.go index 7bdf6853a..4d4839e35 100644 --- a/x/amm/keeper/apply_exit_pool_state_change_test.go +++ b/x/amm/keeper/apply_exit_pool_state_change_test.go @@ -52,21 +52,13 @@ func (suite *AmmKeeperTestSuite) TestApplyExitPoolStateChange() { }, } - swapFee, err := sdkmath.LegacyNewDecFromStr("0.1") + swapFee, err := sdkmath.LegacyNewDecFromStr("0.01") suite.Require().NoError(err) - exitFee, err := sdkmath.LegacyNewDecFromStr("0.1") - suite.Require().NoError(err) - - poolParams := &types.PoolParams{ - SwapFee: swapFee, - ExitFee: exitFee, - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + poolParams := types.PoolParams{ + SwapFee: swapFee, + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, } msg := types.NewMsgCreatePool( @@ -88,7 +80,7 @@ func (suite *AmmKeeperTestSuite) TestApplyExitPoolStateChange() { suite.Require().True(lpTokenBalance.Amount.Equal(sdkmath.ZeroInt())) ctx = ctx.WithBlockTime(ctx.BlockTime().Add(time.Hour)) - _, err = app.AmmKeeper.ApplyExitPoolStateChange(ctx, pool, addrs[0], pool.TotalShares.Amount, coins, false) + err = app.AmmKeeper.ApplyExitPoolStateChange(ctx, pool, addrs[0], pool.TotalShares.Amount, coins, false) suite.Require().NoError(err) }, func() {}, @@ -106,7 +98,7 @@ func (suite *AmmKeeperTestSuite) TestApplyExitPoolStateChange() { coins := sdk.NewCoins(sdk.NewCoin(ptypes.BaseCurrency, sdkmath.NewInt(100000)), sdk.NewCoin("uusdt", sdkmath.NewInt(100000))) - _, err := suite.app.AmmKeeper.ApplyExitPoolStateChange(suite.ctx, pool, addr, pool.TotalShares.Amount, coins, false) + err := suite.app.AmmKeeper.ApplyExitPoolStateChange(suite.ctx, pool, addr, pool.TotalShares.Amount, coins, false) suite.Require().Error(err) }, func() {}, @@ -146,21 +138,13 @@ func (suite *AmmKeeperTestSuite) TestApplyExitPoolStateChange() { }, } - swapFee, err := sdkmath.LegacyNewDecFromStr("0.1") - suite.Require().NoError(err) - - exitFee, err := sdkmath.LegacyNewDecFromStr("0.1") + swapFee, err := sdkmath.LegacyNewDecFromStr("0.01") suite.Require().NoError(err) - poolParams := &types.PoolParams{ - SwapFee: swapFee, - ExitFee: exitFee, - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + poolParams := types.PoolParams{ + SwapFee: swapFee, + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, } msg := types.NewMsgCreatePool( @@ -184,7 +168,7 @@ func (suite *AmmKeeperTestSuite) TestApplyExitPoolStateChange() { coins = sdk.NewCoins(sdk.NewCoin("invalid_denom", sdkmath.NewInt(100000000))) ctx = ctx.WithBlockTime(ctx.BlockTime().Add(time.Hour)) - _, err = app.AmmKeeper.ApplyExitPoolStateChange(ctx, pool, addr, pool.TotalShares.Amount, coins, false) + err = app.AmmKeeper.ApplyExitPoolStateChange(ctx, pool, addr, pool.TotalShares.Amount, coins, false) suite.Require().Error(err) }, func() {}, diff --git a/x/amm/keeper/apply_join_pool_state_change_test.go b/x/amm/keeper/apply_join_pool_state_change_test.go index 127bb5daa..3184dc9b8 100644 --- a/x/amm/keeper/apply_join_pool_state_change_test.go +++ b/x/amm/keeper/apply_join_pool_state_change_test.go @@ -45,15 +45,10 @@ func (suite *AmmKeeperTestSuite) TestApplyJoinPoolStateChange() { }, } - poolParams := &types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - ExitFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, } msg := types.NewMsgCreatePool( @@ -110,15 +105,10 @@ func (suite *AmmKeeperTestSuite) TestApplyJoinPoolStateChange() { }, } - poolParams := &types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - ExitFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, } msg := types.NewMsgCreatePool( @@ -178,15 +168,10 @@ func (suite *AmmKeeperTestSuite) TestApplyJoinPoolStateChange() { }, } - poolParams := &types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - ExitFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, } msg := types.NewMsgCreatePool( @@ -250,15 +235,10 @@ func (suite *AmmKeeperTestSuite) TestApplyJoinPoolStateChange() { }, } - poolParams := &types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - ExitFee: sdkmath.LegacyMustNewDecFromStr("0.1"), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, } msg := types.NewMsgCreatePool( diff --git a/x/amm/keeper/calc_in_route_spot_price_test.go b/x/amm/keeper/calc_in_route_spot_price_test.go index 7b7e0dcc1..7a255d49f 100644 --- a/x/amm/keeper/calc_in_route_spot_price_test.go +++ b/x/amm/keeper/calc_in_route_spot_price_test.go @@ -45,13 +45,9 @@ func (suite *AmmKeeperTestSuite) TestCalcInRouteSpotPrice() { Address: types.NewPoolAddress(uint64(1)).String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + UseOracle: false, + SwapFee: sdkmath.LegacyZeroDec(), + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/calc_out_route_spot_price_test.go b/x/amm/keeper/calc_out_route_spot_price_test.go index 4f97318e1..93eb1823c 100644 --- a/x/amm/keeper/calc_out_route_spot_price_test.go +++ b/x/amm/keeper/calc_out_route_spot_price_test.go @@ -45,13 +45,9 @@ func (suite *AmmKeeperTestSuite) TestCalcOutRouteSpotPrice() { Address: types.NewPoolAddress(uint64(1)).String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + UseOracle: false, + SwapFee: sdkmath.LegacyZeroDec(), + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/calc_swap_estimation_by_denom_test.go b/x/amm/keeper/calc_swap_estimation_by_denom_test.go index 2edd73c8d..a3a1932ca 100644 --- a/x/amm/keeper/calc_swap_estimation_by_denom_test.go +++ b/x/amm/keeper/calc_swap_estimation_by_denom_test.go @@ -45,13 +45,9 @@ func (suite *AmmKeeperTestSuite) TestCalcSwapEstimationByDenom() { Address: types.NewPoolAddress(uint64(1)).String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + UseOracle: false, + SwapFee: sdkmath.LegacyZeroDec(), + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/fee.go b/x/amm/keeper/fee.go index 6429b68be..7b098ecb7 100644 --- a/x/amm/keeper/fee.go +++ b/x/amm/keeper/fee.go @@ -23,7 +23,8 @@ func (k Keeper) OnCollectFee(ctx sdk.Context, pool types.Pool, fee sdk.Coins) er poolRevenueAddress := types.NewPoolRevenueAddress(pool.PoolId) revenueAmount := fee if pool.PoolParams.UseOracle { - weightRecoveryFee := PortionCoins(fee, pool.PoolParams.WeightRecoveryFeePortion) + params := k.GetParams(ctx) + weightRecoveryFee := PortionCoins(fee, params.WeightRecoveryFeePortion) revenueAmount = fee.Sub(weightRecoveryFee...) } @@ -44,6 +45,7 @@ func (k Keeper) OnCollectFee(ctx sdk.Context, pool types.Pool, fee sdk.Coins) er // No fee management required when doing swap from fees to revenue token func (k Keeper) SwapFeesToRevenueToken(ctx sdk.Context, pool types.Pool, fee sdk.Coins) error { poolRevenueAddress := types.NewPoolRevenueAddress(pool.PoolId) + params := k.GetParams(ctx) for _, tokenIn := range fee { // skip for fee denom if tokenIn.Denom == pool.PoolParams.FeeDenom { @@ -52,7 +54,7 @@ func (k Keeper) SwapFeesToRevenueToken(ctx sdk.Context, pool types.Pool, fee sdk // Executes the swap in the pool and stores the output. Updates pool assets but // does not actually transfer any tokens to or from the pool. snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) - tokenOutCoin, _, _, _, err := pool.SwapOutAmtGivenIn(ctx, k.oracleKeeper, &snapshot, sdk.Coins{tokenIn}, pool.PoolParams.FeeDenom, sdkmath.LegacyZeroDec(), k.accountedPoolKeeper, math.LegacyOneDec()) + tokenOutCoin, _, _, _, err := pool.SwapOutAmtGivenIn(ctx, k.oracleKeeper, &snapshot, sdk.Coins{tokenIn}, pool.PoolParams.FeeDenom, sdkmath.LegacyZeroDec(), k.accountedPoolKeeper, math.LegacyOneDec(), params) if err != nil { return err } diff --git a/x/amm/keeper/fee_test.go b/x/amm/keeper/fee_test.go index d2e4a73cc..8dc7b33cf 100644 --- a/x/amm/keeper/fee_test.go +++ b/x/amm/keeper/fee_test.go @@ -86,14 +86,9 @@ func (suite *AmmKeeperTestSuite) TestOnCollectFee() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ @@ -182,14 +177,9 @@ func (suite *AmmKeeperTestSuite) TestSwapFeesToRevenueToken() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/keeper_create_pool.go b/x/amm/keeper/keeper_create_pool.go index 197fad76b..1c027c4e5 100644 --- a/x/amm/keeper/keeper_create_pool.go +++ b/x/amm/keeper/keeper_create_pool.go @@ -38,7 +38,7 @@ func (k Keeper) CreatePool(ctx sdk.Context, msg *types.MsgCreatePool) (uint64, e // Get the next pool ID and increment the pool ID counter // Create the pool with the given pool ID poolId := k.GetNextPoolId(ctx) - pool, err := types.NewBalancerPool(poolId, *msg.PoolParams, msg.PoolAssets, ctx.BlockTime()) + pool, err := types.NewBalancerPool(poolId, msg.PoolParams, msg.PoolAssets, ctx.BlockTime()) if err != nil { return 0, err } diff --git a/x/amm/keeper/keeper_exit_pool.go b/x/amm/keeper/keeper_exit_pool.go index 536725bbc..3acc12699 100644 --- a/x/amm/keeper/keeper_exit_pool.go +++ b/x/amm/keeper/keeper_exit_pool.go @@ -15,37 +15,38 @@ func (k Keeper) ExitPool( tokenOutMins sdk.Coins, tokenOutDenom string, isLiquidation bool, -) (exitCoins, exitCoinsAfterExitFee sdk.Coins, err error) { +) (exitCoins sdk.Coins, err error) { pool, poolExists := k.GetPool(ctx, poolId) if !poolExists { - return sdk.Coins{}, sdk.Coins{}, types.ErrInvalidPoolId + return sdk.Coins{}, types.ErrInvalidPoolId } totalSharesAmount := pool.GetTotalShares() if shareInAmount.GTE(totalSharesAmount.Amount) { - return sdk.Coins{}, sdk.Coins{}, errorsmod.Wrapf(types.ErrInvalidMathApprox, "Trying to exit >= the number of shares contained in the pool.") + return sdk.Coins{}, errorsmod.Wrapf(types.ErrInvalidMathApprox, "Trying to exit >= the number of shares contained in the pool.") } else if shareInAmount.LTE(math.ZeroInt()) { - return sdk.Coins{}, sdk.Coins{}, errorsmod.Wrapf(types.ErrInvalidMathApprox, "Trying to exit a negative amount of shares") + return sdk.Coins{}, errorsmod.Wrapf(types.ErrInvalidMathApprox, "Trying to exit a negative amount of shares") } - exitCoins, err = pool.ExitPool(ctx, k.oracleKeeper, k.accountedPoolKeeper, shareInAmount, tokenOutDenom) + params := k.GetParams(ctx) + exitCoins, err = pool.ExitPool(ctx, k.oracleKeeper, k.accountedPoolKeeper, shareInAmount, tokenOutDenom, params) if err != nil { - return sdk.Coins{}, sdk.Coins{}, err + return sdk.Coins{}, err } if !tokenOutMins.DenomsSubsetOf(exitCoins) || tokenOutMins.IsAnyGT(exitCoins) { - return sdk.Coins{}, sdk.Coins{}, errorsmod.Wrapf(types.ErrLimitMinAmount, + return sdk.Coins{}, errorsmod.Wrapf(types.ErrLimitMinAmount, "Exit pool returned %s , minimum tokens out specified as %s", exitCoins, tokenOutMins) } - exitCoinsAfterExitFee, err = k.ApplyExitPoolStateChange(ctx, pool, sender, shareInAmount, exitCoins, isLiquidation) + err = k.ApplyExitPoolStateChange(ctx, pool, sender, shareInAmount, exitCoins, isLiquidation) if err != nil { - return sdk.Coins{}, sdk.Coins{}, err + return sdk.Coins{}, err } err = k.RecordTotalLiquidityDecrease(ctx, exitCoins) if err != nil { - return nil, nil, err + return sdk.Coins{}, err } - return exitCoins, exitCoinsAfterExitFee, nil + return exitCoins, nil } diff --git a/x/amm/keeper/keeper_join_pool_no_swap.go b/x/amm/keeper/keeper_join_pool_no_swap.go index b18738d27..145b70b82 100644 --- a/x/amm/keeper/keeper_join_pool_no_swap.go +++ b/x/amm/keeper/keeper_join_pool_no_swap.go @@ -65,9 +65,9 @@ func (k Keeper) JoinPoolNoSwap( tokensIn = neededLpLiquidity } - + params := k.GetParams(ctx) snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) - sharesOut, _, weightBalanceBonus, err := pool.JoinPool(ctx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokensIn) + sharesOut, _, weightBalanceBonus, err := pool.JoinPool(ctx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokensIn, params) if err != nil { return nil, sdkmath.ZeroInt(), err } @@ -91,9 +91,10 @@ func (k Keeper) JoinPoolNoSwap( return tokensIn, sharesOut, err } + params := k.GetParams(ctx) // on oracle pool, full tokenInMaxs are used regardless shareOutAmount snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) - sharesOut, _, weightBalanceBonus, err := pool.JoinPool(ctx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokenInMaxs) + sharesOut, _, weightBalanceBonus, err := pool.JoinPool(ctx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokenInMaxs, params) if err != nil { return nil, sdkmath.ZeroInt(), err } diff --git a/x/amm/keeper/keeper_swap_exact_amount_in.go b/x/amm/keeper/keeper_swap_exact_amount_in.go index 383e0cb5c..51c5f3987 100644 --- a/x/amm/keeper/keeper_swap_exact_amount_in.go +++ b/x/amm/keeper/keeper_swap_exact_amount_in.go @@ -38,11 +38,11 @@ func (k Keeper) InternalSwapExactAmountIn( err = fmt.Errorf("function SwapExactAmountIn failed due to an internal reason: %v", r) } }() - + params := k.GetParams(ctx) // Executes the swap in the pool and stores the output. Updates pool assets but // does not actually transfer any tokens to or from the pool. snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) - tokenOutCoin, _, slippageAmount, weightBalanceBonus, err := pool.SwapOutAmtGivenIn(ctx, k.oracleKeeper, &snapshot, tokensIn, tokenOutDenom, swapFee, k.accountedPoolKeeper, math.LegacyOneDec()) + tokenOutCoin, _, slippageAmount, weightBalanceBonus, err := pool.SwapOutAmtGivenIn(ctx, k.oracleKeeper, &snapshot, tokensIn, tokenOutDenom, swapFee, k.accountedPoolKeeper, math.LegacyOneDec(), params) if err != nil { return math.Int{}, err } diff --git a/x/amm/keeper/keeper_swap_exact_amount_in_test.go b/x/amm/keeper/keeper_swap_exact_amount_in_test.go index 4b1d70443..0e3134b72 100644 --- a/x/amm/keeper/keeper_swap_exact_amount_in_test.go +++ b/x/amm/keeper/keeper_swap_exact_amount_in_test.go @@ -114,13 +114,13 @@ func (suite *AmmKeeperTestSuite) TestSwapExactAmountIn() { swapFeeOut: sdkmath.LegacyZeroDec(), tokenIn: sdk.NewInt64Coin("uusda", 10000), tokenOutMin: sdkmath.ZeroInt(), - tokenOut: sdk.NewInt64Coin(ptypes.BaseCurrency, 9975), + tokenOut: sdk.NewInt64Coin(ptypes.BaseCurrency, 9969), weightBalanceBonus: sdkmath.LegacyZeroDec(), isOraclePool: true, useNewRecipient: false, - expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 990000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1009975)}, + expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 990000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1009969)}, expRecipientBalance: sdk.Coins{}, - expPoolBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1010000), sdk.NewInt64Coin(ptypes.BaseCurrency, 990025)}, + expPoolBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1010000), sdk.NewInt64Coin(ptypes.BaseCurrency, 990031)}, expTreasuryBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, expPass: true, }, @@ -221,13 +221,9 @@ func (suite *AmmKeeperTestSuite) TestSwapExactAmountIn() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - UseOracle: tc.isOraclePool, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: tc.swapFeeIn, - FeeDenom: ptypes.BaseCurrency, + UseOracle: tc.isOraclePool, + SwapFee: tc.swapFeeIn, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/keeper_swap_exact_amount_out.go b/x/amm/keeper/keeper_swap_exact_amount_out.go index 4fa92b229..0dc771269 100644 --- a/x/amm/keeper/keeper_swap_exact_amount_out.go +++ b/x/amm/keeper/keeper_swap_exact_amount_out.go @@ -40,8 +40,9 @@ func (k Keeper) InternalSwapExactAmountOut( return math.Int{}, errorsmod.Wrapf(types.ErrTooManyTokensOut, "cannot get more tokens out than there are tokens in the pool") } + params := k.GetParams(ctx) snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) - tokenIn, _, slippageAmount, weightBalanceBonus, err := pool.SwapInAmtGivenOut(ctx, k.oracleKeeper, &snapshot, sdk.Coins{tokenOut}, tokenInDenom, swapFee, k.accountedPoolKeeper, math.LegacyOneDec()) + tokenIn, _, slippageAmount, weightBalanceBonus, err := pool.SwapInAmtGivenOut(ctx, k.oracleKeeper, &snapshot, sdk.Coins{tokenOut}, tokenInDenom, swapFee, k.accountedPoolKeeper, math.LegacyOneDec(), params) if err != nil { return math.Int{}, err } diff --git a/x/amm/keeper/keeper_swap_exact_amount_out_test.go b/x/amm/keeper/keeper_swap_exact_amount_out_test.go index 09a38956c..fcd850a6f 100644 --- a/x/amm/keeper/keeper_swap_exact_amount_out_test.go +++ b/x/amm/keeper/keeper_swap_exact_amount_out_test.go @@ -106,15 +106,15 @@ func (suite *AmmKeeperTestSuite) TestSwapExactAmountOut() { poolInitBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, treasuryInitBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, swapFeeOut: sdkmath.LegacyZeroDec(), - tokenIn: sdk.NewInt64Coin("uusda", 211112), + tokenIn: sdk.NewInt64Coin("uusda", 211409), tokenInMax: sdkmath.NewInt(10000000), tokenOut: sdk.NewInt64Coin(ptypes.BaseCurrency, 200000), weightBalanceBonus: sdkmath.LegacyZeroDec(), isOraclePool: true, useNewRecipient: false, - expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 788888), sdk.NewInt64Coin(ptypes.BaseCurrency, 1200000)}, + expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 788591), sdk.NewInt64Coin(ptypes.BaseCurrency, 1200000)}, expRecipientBalance: sdk.Coins{}, - expPoolBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1211112), sdk.NewInt64Coin(ptypes.BaseCurrency, 800000)}, + expPoolBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1211409), sdk.NewInt64Coin(ptypes.BaseCurrency, 800000)}, expTreasuryBalance: sdk.Coins{sdk.NewInt64Coin("uusda", 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, expPass: true, }, @@ -212,13 +212,9 @@ func (suite *AmmKeeperTestSuite) TestSwapExactAmountOut() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - UseOracle: tc.isOraclePool, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: tc.swapFeeOut, - FeeDenom: ptypes.BaseCurrency, + UseOracle: tc.isOraclePool, + SwapFee: tc.swapFeeOut, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/keeper_test.go b/x/amm/keeper/keeper_test.go index 764f1684f..b40c87188 100644 --- a/x/amm/keeper/keeper_test.go +++ b/x/amm/keeper/keeper_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "sort" "strings" "testing" @@ -117,8 +119,15 @@ func (suite *AmmKeeperTestSuite) AddAccounts(n int, given []sdk.AccAddress) []sd func (suite *AmmKeeperTestSuite) SetAmmParams() { suite.app.AmmKeeper.SetParams(suite.ctx, types.Params{ - PoolCreationFee: math.NewInt(10000000), - SlippageTrackDuration: 604800, + PoolCreationFee: math.NewInt(10_000_000), + SlippageTrackDuration: 604800, + BaseAssets: []string{ptypes.BaseCurrency}, + AllowedPoolCreators: []string{authtypes.NewModuleAddress(govtypes.ModuleName).String()}, + WeightBreakingFeeExponent: math.LegacyMustNewDecFromStr("2.5"), + WeightBreakingFeeMultiplier: math.LegacyMustNewDecFromStr("0.0005"), + WeightBreakingFeePortion: math.LegacyMustNewDecFromStr("0.5"), + WeightRecoveryFeePortion: math.LegacyMustNewDecFromStr("0.1"), + ThresholdWeightDifference: math.LegacyMustNewDecFromStr("0.3"), }) } @@ -224,19 +233,14 @@ func (suite *AmmKeeperTestSuite) CreateNewAmmPool(creator sdk.AccAddress, useOra return strings.Compare(poolAssets[i].Token.Denom, poolAssets[j].Token.Denom) <= 0 }) poolParams := types.PoolParams{ - UseOracle: useOracle, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: swapFee, - ExitFee: exitFee, - FeeDenom: ptypes.BaseCurrency, + UseOracle: useOracle, + SwapFee: swapFee, + FeeDenom: ptypes.BaseCurrency, } createPoolMsg := &types.MsgCreatePool{ Sender: creator.String(), - PoolParams: &poolParams, + PoolParams: poolParams, PoolAssets: poolAssets, } diff --git a/x/amm/keeper/msg_server_create_pool.go b/x/amm/keeper/msg_server_create_pool.go index 3670502eb..15b1ff1ae 100644 --- a/x/amm/keeper/msg_server_create_pool.go +++ b/x/amm/keeper/msg_server_create_pool.go @@ -2,12 +2,13 @@ package keeper import ( "context" + "fmt" "strconv" + "strings" errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/elys-network/elys/x/amm/types" - assetprofiletypes "github.com/elys-network/elys/x/assetprofile/types" ptypes "github.com/elys-network/elys/x/parameter/types" ) @@ -15,31 +16,32 @@ import ( // The pool creation fee is used to fund the community pool. // It will create a dedicated module account for the pool and sends the initial liquidity to the created module account. func (k msgServer) CreatePool(goCtx context.Context, msg *types.MsgCreatePool) (*types.MsgCreatePoolResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) // Pay pool creation fee - sender := sdk.MustAccAddressFromBech32(msg.Sender) params := k.GetParams(ctx) - if params.EnableBaseCurrencyPairedPoolOnly { - baseCurrency, found := k.assetProfileKeeper.GetUsdcDenom(ctx) - if !found { - return nil, errorsmod.Wrapf(assetprofiletypes.ErrAssetProfileNotFound, "asset %s not found", ptypes.BaseCurrency) - } + if !params.IsCreatorAllowed(msg.Sender) { + return nil, fmt.Errorf("sender is not allowed to create pool") + } - is_base_curency_paired_pool := false - for _, asset := range msg.PoolAssets { - if asset.Token.Denom == baseCurrency { - is_base_curency_paired_pool = true - } - } - if !is_base_curency_paired_pool { - return nil, errorsmod.Wrapf(types.ErrOnlyBaseCurrencyPoolAllowed, "one of the asset must be %s", ptypes.BaseCurrency) + sender := sdk.MustAccAddressFromBech32(msg.Sender) + + baseAssetExists := false + for _, asset := range msg.PoolAssets { + baseAssetExists = k.CheckBaseAssetExist(ctx, asset.Token.Denom) + if baseAssetExists { + break } } + if !baseAssetExists { + return nil, errorsmod.Wrapf(types.ErrOnlyBaseAssetsPoolAllowed, "one of the asset must be from %s", strings.Join(params.BaseAssets, ", ")) + } + + feeAssetExists := k.CheckBaseAssetExist(ctx, msg.PoolParams.FeeDenom) + if !feeAssetExists { + return nil, fmt.Errorf("fee denom must be from %s", strings.Join(params.BaseAssets, ", ")) + } if !params.PoolCreationFee.IsNil() && params.PoolCreationFee.IsPositive() { feeCoins := sdk.Coins{sdk.NewCoin(ptypes.Elys, params.PoolCreationFee)} diff --git a/x/amm/keeper/msg_server_create_pool_test.go b/x/amm/keeper/msg_server_create_pool_test.go index 156bf1da5..a99123312 100644 --- a/x/amm/keeper/msg_server_create_pool_test.go +++ b/x/amm/keeper/msg_server_create_pool_test.go @@ -4,8 +4,10 @@ import ( "fmt" sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto/ed25519" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" 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" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/elys-network/elys/x/amm/keeper" "github.com/elys-network/elys/x/amm/types" @@ -25,19 +27,36 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { expPass bool }{ { - desc: "zero tvl pool creation", - senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 11000000)}, + desc: "sender is not authorized", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10_000_000)}, enableBaseCurrencyPairedPoolOnly: false, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, + }, + poolAssets: []types.PoolAsset{ + { + Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Weight: sdkmath.OneInt(), + }, + { + Token: sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), + Weight: sdkmath.OneInt(), + }, + }, + expSenderBalance: sdk.Coins{}, + expLpCommitment: sdk.Coin{}, + expPass: false, + }, + { + desc: "no asset is base asset", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10_000_000)}, + enableBaseCurrencyPairedPoolOnly: false, + poolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -50,7 +69,53 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { }, }, expSenderBalance: sdk.Coins{}, - expLpCommitment: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(100).Mul(types.OneShare)), + expLpCommitment: sdk.Coin{}, + expPass: false, + }, + { + desc: "fee is not base asset", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10_000_000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, + enableBaseCurrencyPairedPoolOnly: false, + poolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.Elys, + }, + poolAssets: []types.PoolAsset{ + { + Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Weight: sdkmath.OneInt(), + }, + { + Token: sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), + Weight: sdkmath.OneInt(), + }, + }, + expSenderBalance: sdk.Coins{}, + expLpCommitment: sdk.Coin{}, + expPass: false, + }, + { + desc: "zero tvl pool creation", + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10_000_000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, + enableBaseCurrencyPairedPoolOnly: false, + poolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, + }, + poolAssets: []types.PoolAsset{ + { + Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Weight: sdkmath.OneInt(), + }, + { + Token: sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), + Weight: sdkmath.OneInt(), + }, + }, + expSenderBalance: sdk.Coins{}, + expLpCommitment: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(2000000000000000000)), expPass: true, }, { @@ -58,15 +123,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, enableBaseCurrencyPairedPoolOnly: false, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -87,15 +146,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10000000)}, enableBaseCurrencyPairedPoolOnly: false, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -116,15 +169,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, enableBaseCurrencyPairedPoolOnly: true, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -145,15 +192,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, enableBaseCurrencyPairedPoolOnly: true, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -180,7 +221,10 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { fmt.Println(b) // bootstrap accounts - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + sender := authtypes.NewModuleAddress(govtypes.ModuleName) + if tc.desc == "sender is not authorized" { + sender = sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + } // bootstrap balances err := suite.app.BankKeeper.MintCoins(suite.ctx, minttypes.ModuleName, tc.senderInitBalance) @@ -193,14 +237,14 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { // set params params := suite.app.AmmKeeper.GetParams(suite.ctx) - params.EnableBaseCurrencyPairedPoolOnly = tc.enableBaseCurrencyPairedPoolOnly + params.BaseAssets = []string{ptypes.BaseCurrency} suite.app.AmmKeeper.SetParams(suite.ctx, params) resp, err := msgServer.CreatePool( suite.ctx, &types.MsgCreatePool{ Sender: sender.String(), - PoolParams: &tc.poolParams, + PoolParams: tc.poolParams, PoolAssets: tc.poolAssets, }) if !tc.expPass { @@ -213,7 +257,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerCreatePool() { suite.Require().Len(pools, 1) suite.Require().Equal(pools[0].PoolId, uint64(1)) suite.Require().Equal(pools[0].PoolParams, tc.poolParams) - suite.Require().Equal(pools[0].TotalShares.Amount.String(), tc.expLpCommitment.Amount.String()) + suite.Require().Equal(tc.expLpCommitment.Amount.String(), pools[0].TotalShares.Amount.String()) totalWeight := sdkmath.ZeroInt() for _, poolAsset := range tc.poolAssets { diff --git a/x/amm/keeper/msg_server_exit_pool.go b/x/amm/keeper/msg_server_exit_pool.go index e28316099..b4ad8eaf6 100644 --- a/x/amm/keeper/msg_server_exit_pool.go +++ b/x/amm/keeper/msg_server_exit_pool.go @@ -8,17 +8,13 @@ import ( ) func (k msgServer) ExitPool(goCtx context.Context, msg *types.MsgExitPool) (*types.MsgExitPoolResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) sender, err := sdk.AccAddressFromBech32(msg.Sender) if err != nil { return nil, err } - - exitCoins, _, err := k.Keeper.ExitPool(ctx, sender, msg.PoolId, msg.ShareAmountIn, msg.MinAmountsOut, msg.TokenOutDenom, false) + exitCoins, err := k.Keeper.ExitPool(ctx, sender, msg.PoolId, msg.ShareAmountIn, msg.MinAmountsOut, msg.TokenOutDenom, false) if err != nil { return nil, err } diff --git a/x/amm/keeper/msg_server_exit_pool_test.go b/x/amm/keeper/msg_server_exit_pool_test.go index b9ade3b51..3118a240e 100644 --- a/x/amm/keeper/msg_server_exit_pool_test.go +++ b/x/amm/keeper/msg_server_exit_pool_test.go @@ -1,10 +1,11 @@ package keeper_test import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "time" sdkmath "cosmossdk.io/math" - "github.com/cometbft/cometbft/crypto/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" "github.com/elys-network/elys/x/amm/keeper" @@ -28,15 +29,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerExitPool() { desc: "successful non-oracle exit pool", poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), sdk.NewInt64Coin("uusdt", 1000000)}, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, shareInAmount: types.OneShare.Quo(sdkmath.NewInt(5)), tokenOutDenom: "", @@ -48,15 +43,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerExitPool() { desc: "not enough balance to exit pool - non-oracle pool", poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), sdk.NewInt64Coin("uusdt", 1000000)}, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, shareInAmount: types.OneShare.Quo(sdkmath.NewInt(5)), tokenOutDenom: "", @@ -68,42 +57,30 @@ func (suite *AmmKeeperTestSuite) TestMsgServerExitPool() { desc: "oracle pool exit - breaking weight on balanced pool", poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), sdk.NewInt64Coin("uusdt", 1000000)}, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyNewDecWithPrec(1, 2), // 0.01 - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyNewDecWithPrec(2, 1), // 20% - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, }, shareInAmount: types.OneShare.Quo(sdkmath.NewInt(10)), tokenOutDenom: "uusdt", - minAmountsOut: sdk.Coins{sdk.NewInt64Coin("uusdt", 98699)}, + minAmountsOut: sdk.Coins{sdk.NewInt64Coin("uusdt", 99935)}, // expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusdt", 95114)}, // slippage enabled - expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusdt", 98699)}, // slippage disabled + expSenderBalance: sdk.Coins{sdk.NewInt64Coin("uusdt", 99935)}, // slippage disabled expPass: true, }, { desc: "oracle pool exit - weight recovering on imbalanced pool", poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1500000), sdk.NewInt64Coin("uusdt", 500000)}, poolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyNewDecWithPrec(1, 2), // 0.01 - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyNewDecWithPrec(2, 1), // 20% - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, }, shareInAmount: types.OneShare.Quo(sdkmath.NewInt(10)), tokenOutDenom: ptypes.BaseCurrency, - minAmountsOut: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 86881)}, + minAmountsOut: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 99344)}, // expSenderBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 99197)}, // slippage enabled - expSenderBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 86881)}, // slippage disabled + expSenderBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 99344)}, // slippage disabled expPass: true, }, } { @@ -114,7 +91,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerExitPool() { suite.SetupAssetProfile() // bootstrap accounts - sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) + sender := authtypes.NewModuleAddress(govtypes.ModuleName) params := suite.app.AmmKeeper.GetParams(suite.ctx) // bootstrap balances poolCreationFee := sdk.NewCoin(ptypes.Elys, params.PoolCreationFee) @@ -140,7 +117,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerExitPool() { suite.ctx, &types.MsgCreatePool{ Sender: sender.String(), - PoolParams: &tc.poolParams, + PoolParams: tc.poolParams, PoolAssets: poolAssets, }) suite.Require().NoError(err) diff --git a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go index 206be2acd..ef21f501d 100644 --- a/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go +++ b/x/amm/keeper/msg_server_feed_multiple_external_liquidity.go @@ -64,9 +64,6 @@ func LiquidityRatioFromPriceDepth(depth sdkmath.LegacyDec) sdkmath.LegacyDec { } func (k msgServer) FeedMultipleExternalLiquidity(goCtx context.Context, msg *types.MsgFeedMultipleExternalLiquidity) (*types.MsgFeedMultipleExternalLiquidityResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) feeder, found := k.oracleKeeper.GetPriceFeeder(ctx, sdk.MustAccAddressFromBech32(msg.Sender)) diff --git a/x/amm/keeper/msg_server_feed_multiple_external_liquidity_test.go b/x/amm/keeper/msg_server_feed_multiple_external_liquidity_test.go index 0e2219c49..e02e71e9a 100644 --- a/x/amm/keeper/msg_server_feed_multiple_external_liquidity_test.go +++ b/x/amm/keeper/msg_server_feed_multiple_external_liquidity_test.go @@ -2,6 +2,7 @@ package keeper_test import ( "fmt" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "cosmossdk.io/math" sdkmath "cosmossdk.io/math" @@ -250,7 +251,7 @@ func (suite *AmmKeeperTestSuite) TestFeedMultipleExternalLiquidity() { // msg server msgServer := keeper.NewMsgServerImpl(*suite.app.AmmKeeper) - _, err := msgServer.FeedMultipleExternalLiquidity(suite.ctx, &types.MsgFeedMultipleExternalLiquidity{}) + _, err := msgServer.FeedMultipleExternalLiquidity(suite.ctx, &types.MsgFeedMultipleExternalLiquidity{Sender: authtypes.NewModuleAddress("test").String()}) suite.Require().Error(err) }, }, diff --git a/x/amm/keeper/msg_server_join_pool.go b/x/amm/keeper/msg_server_join_pool.go index a64985296..bb0077f1a 100644 --- a/x/amm/keeper/msg_server_join_pool.go +++ b/x/amm/keeper/msg_server_join_pool.go @@ -20,9 +20,6 @@ import ( // Balancer: TokensInMaxs provided as the argument must either contain no tokens or containing all assets in the pool. // * For the case of a not containing tokens, we simply perform calculation of sharesOut and needed amount of tokens for joining the pool func (k msgServer) JoinPool(goCtx context.Context, msg *types.MsgJoinPool) (*types.MsgJoinPoolResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) sender, err := sdk.AccAddressFromBech32(msg.Sender) diff --git a/x/amm/keeper/msg_server_join_pool_test.go b/x/amm/keeper/msg_server_join_pool_test.go index 0c0a67ebd..aa19b6245 100644 --- a/x/amm/keeper/msg_server_join_pool_test.go +++ b/x/amm/keeper/msg_server_join_pool_test.go @@ -27,15 +27,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 100000), sdk.NewInt64Coin("uusdt", 100000)}, poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), sdk.NewInt64Coin("uusdt", 1000000)}, poolParams: types.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - WeightBreakingFeePortion: math.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: math.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, shareOutAmount: types.OneShare.Quo(math.NewInt(5)), expSenderBalance: sdk.Coins{}, @@ -47,15 +41,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), sdk.NewInt64Coin("uusdt", 1000000)}, poolParams: types.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - WeightBreakingFeePortion: math.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: math.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, shareOutAmount: types.OneShare.Quo(math.NewInt(5)), expSenderBalance: sdk.Coins{}, @@ -67,18 +55,12 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin("uusdt", 1000000)}, poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), sdk.NewInt64Coin("uusdt", 1000000)}, poolParams: types.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyNewDecWithPrec(1, 2), // 0.01 - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyNewDecWithPrec(2, 1), // 20% - WeightBreakingFeePortion: math.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: math.LegacyZeroDec(), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, }, // shareOutAmount: math.NewInt(694444166666666666), // weight breaking fee - slippage enable - shareOutAmount: math.NewInt(943431457505076198), // weight breaking fee - slippage disable + shareOutAmount: math.NewInt(997171572875253810), // weight breaking fee - slippage disable expSenderBalance: sdk.Coins{}, expTokenIn: sdk.Coins{sdk.NewInt64Coin("uusdt", 1000000)}, expPass: true, @@ -88,18 +70,12 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin("uusdt", 1000000)}, poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1500000), sdk.NewInt64Coin("uusdt", 500000)}, poolParams: types.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyNewDecWithPrec(1, 2), // 0.01 - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyNewDecWithPrec(2, 1), // 20% - WeightBreakingFeePortion: math.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: math.LegacyZeroDec(), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, }, // shareOutAmount: math.NewInt(805987500000000000), // weight recovery direction - slippage enable - shareOutAmount: math.NewInt(1000000000000000000), // weight recovery direction - slippage disable + shareOutAmount: math.NewInt(999500000000000000), // weight recovery direction - slippage disable expSenderBalance: sdk.Coins{}, expTokenIn: sdk.Coins{sdk.NewInt64Coin("uusdt", 1000000)}, expPass: true, @@ -109,15 +85,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPool() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1500000), sdk.NewInt64Coin("uusdt", 500000)}, poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 1500000), sdk.NewInt64Coin("uusdt", 500000)}, poolParams: types.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyNewDecWithPrec(1, 2), // 0.01 - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyNewDecWithPrec(2, 1), // 20% - WeightBreakingFeePortion: math.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: math.LegacyZeroDec(), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, }, shareOutAmount: math.NewInt(2000000000000000000), expSenderBalance: sdk.Coins{}, @@ -228,15 +198,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerJoinPoolExploitScenario() { senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.ATOM, 100_000_000_000000)}, poolInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.ATOM, 100_000_000_000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100_000_000_000000)}, poolParams: types.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyNewDecWithPrec(1, 2), // 0.01 - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyNewDecWithPrec(2, 1), // 20% - WeightBreakingFeePortion: math.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: math.LegacyZeroDec(), + UseOracle: true, + FeeDenom: ptypes.BaseCurrency, }, shareOutAmount: math.NewInt(2_000000000000000000), expSenderBalance: sdk.Coins{}, diff --git a/x/amm/keeper/msg_server_swap_by_denom.go b/x/amm/keeper/msg_server_swap_by_denom.go index 8fb56f7f8..aa9796141 100644 --- a/x/amm/keeper/msg_server_swap_by_denom.go +++ b/x/amm/keeper/msg_server_swap_by_denom.go @@ -13,9 +13,6 @@ import ( ) func (k msgServer) SwapByDenom(goCtx context.Context, msg *types.MsgSwapByDenom) (*types.MsgSwapByDenomResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) return k.Keeper.SwapByDenom(ctx, msg) diff --git a/x/amm/keeper/msg_server_swap_exact_amount_in.go b/x/amm/keeper/msg_server_swap_exact_amount_in.go index a40e5fd4b..622fd42ca 100644 --- a/x/amm/keeper/msg_server_swap_exact_amount_in.go +++ b/x/amm/keeper/msg_server_swap_exact_amount_in.go @@ -9,9 +9,6 @@ import ( ) func (k msgServer) SwapExactAmountIn(goCtx context.Context, msg *types.MsgSwapExactAmountIn) (*types.MsgSwapExactAmountInResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) // Swap event is handled elsewhere diff --git a/x/amm/keeper/msg_server_swap_exact_amount_in_test.go b/x/amm/keeper/msg_server_swap_exact_amount_in_test.go index 77e076b1c..2c972306d 100644 --- a/x/amm/keeper/msg_server_swap_exact_amount_in_test.go +++ b/x/amm/keeper/msg_server_swap_exact_amount_in_test.go @@ -210,15 +210,15 @@ func (suite *AmmKeeperTestSuite) TestMsgServerSlippageDifferenceWhenSplit() { swapFee := sdkmath.LegacyZeroDec() tokenIn := sdk.NewInt64Coin(ptypes.BaseCurrency, 100000) tokenOutMin := sdkmath.ZeroInt() - tokenOut := sdk.NewInt64Coin("uusdt", 99900) + tokenOut := sdk.NewInt64Coin("uusdt", 99817) swapRoute := []types.SwapAmountInRoute{ { PoolId: 1, TokenOutDenom: "uusdt", }, } - expSenderBalance := sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 900000), sdk.NewInt64Coin("uusdt", 99900)} - expSenderBalanceSplitSwap := sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 900000), sdk.NewInt64Coin("uusdt", 99024)} + expSenderBalance := sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 900000), sdk.NewInt64Coin("uusdt", 99817)} + expSenderBalanceSplitSwap := sdk.Coins{sdk.NewInt64Coin(ptypes.BaseCurrency, 900000), sdk.NewInt64Coin("uusdt", 98924)} // bootstrap accounts sender := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) @@ -282,7 +282,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerSlippageDifferenceWhenSplit() { TokenOutMinAmount: tokenOutMin, }) suite.Require().NoError(err) - suite.Require().Equal(resp.TokenOutAmount.String(), tokenOut.Amount.String()) + suite.Require().Equal(tokenOut.Amount.String(), resp.TokenOutAmount.String()) suite.app.AmmKeeper.EndBlocker(cacheCtx) // check balance change on sender diff --git a/x/amm/keeper/msg_server_swap_exact_amount_out.go b/x/amm/keeper/msg_server_swap_exact_amount_out.go index f2b800473..76084facb 100644 --- a/x/amm/keeper/msg_server_swap_exact_amount_out.go +++ b/x/amm/keeper/msg_server_swap_exact_amount_out.go @@ -8,9 +8,6 @@ import ( ) func (k msgServer) SwapExactAmountOut(goCtx context.Context, msg *types.MsgSwapExactAmountOut) (*types.MsgSwapExactAmountOutResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) // Swap event is handled elsewhere diff --git a/x/amm/keeper/msg_server_update_params.go b/x/amm/keeper/msg_server_update_params.go index c7e52cd30..ecf99bd4b 100644 --- a/x/amm/keeper/msg_server_update_params.go +++ b/x/amm/keeper/msg_server_update_params.go @@ -10,9 +10,6 @@ import ( ) func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) if k.authority != msg.Authority { diff --git a/x/amm/keeper/msg_server_update_pool_params.go b/x/amm/keeper/msg_server_update_pool_params.go index 05a763516..f3da01d05 100644 --- a/x/amm/keeper/msg_server_update_pool_params.go +++ b/x/amm/keeper/msg_server_update_pool_params.go @@ -34,16 +34,13 @@ func (k Keeper) UpdatePoolParams(ctx sdk.Context, poolId uint64, poolParams type } func (k msgServer) UpdatePoolParams(goCtx context.Context, msg *types.MsgUpdatePoolParams) (*types.MsgUpdatePoolParamsResponse, error) { - if err := msg.ValidateBasic(); err != nil { - return nil, err - } ctx := sdk.UnwrapSDKContext(goCtx) if k.authority != msg.Authority { return nil, errorsmod.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) } - poolId, poolParams, err := k.Keeper.UpdatePoolParams(ctx, msg.PoolId, *msg.PoolParams) + poolId, poolParams, err := k.Keeper.UpdatePoolParams(ctx, msg.PoolId, msg.PoolParams) if err != nil { return nil, err } diff --git a/x/amm/keeper/msg_server_update_pool_params_test.go b/x/amm/keeper/msg_server_update_pool_params_test.go index 6f43e14df..cfc536259 100644 --- a/x/amm/keeper/msg_server_update_pool_params_test.go +++ b/x/amm/keeper/msg_server_update_pool_params_test.go @@ -25,67 +25,43 @@ func (suite *AmmKeeperTestSuite) TestMsgServerUpdatePoolParams() { }{ { desc: "zero tvl pool creation", - senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.Elys, 1000000)}, + senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Elys, 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000_000)}, initialPoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, updatedPoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), - ExitFee: sdkmath.LegacyMustNewDecFromStr("0.02"), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: "feedenom", + SwapFee: sdkmath.LegacyMustNewDecFromStr("0.01"), + UseOracle: false, + FeeDenom: "feedenom", }, poolAssets: []types.PoolAsset{ { - Token: sdk.NewInt64Coin(ptypes.Eden, 1000000), + Token: sdk.NewInt64Coin(ptypes.Elys, 1000000), Weight: sdkmath.OneInt(), }, { - Token: sdk.NewInt64Coin(ptypes.Elys, 1000000), + Token: sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000), Weight: sdkmath.OneInt(), }, }, expSenderBalance: sdk.Coins{}, - expLpCommitment: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(100).Mul(types.OneShare)), + expLpCommitment: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(2000000000000000000)), expPass: true, }, { desc: "positive tvl pool creation", senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 1000000)}, initialPoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, updatedPoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -105,15 +81,9 @@ func (suite *AmmKeeperTestSuite) TestMsgServerUpdatePoolParams() { desc: "not enough balance to create pool", senderInitBalance: sdk.Coins{sdk.NewInt64Coin(ptypes.Eden, 1000000)}, initialPoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, poolAssets: []types.PoolAsset{ { @@ -156,7 +126,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerUpdatePoolParams() { suite.ctx, &types.MsgCreatePool{ Sender: sender.String(), - PoolParams: &tc.initialPoolParams, + PoolParams: tc.initialPoolParams, PoolAssets: tc.poolAssets, }) if !tc.expPass { @@ -192,7 +162,7 @@ func (suite *AmmKeeperTestSuite) TestMsgServerUpdatePoolParams() { &types.MsgUpdatePoolParams{ Authority: sender.String(), PoolId: pools[0].PoolId, - PoolParams: &tc.updatedPoolParams, + PoolParams: tc.updatedPoolParams, }) suite.Require().NoError(err) diff --git a/x/amm/keeper/params.go b/x/amm/keeper/params.go index 43f7b99a0..f04c17077 100644 --- a/x/amm/keeper/params.go +++ b/x/amm/keeper/params.go @@ -1,9 +1,12 @@ package keeper import ( + errorsmod "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/elys-network/elys/x/amm/types" + assetprofiletypes "github.com/elys-network/elys/x/assetprofile/types" + ptypes "github.com/elys-network/elys/x/parameter/types" ) func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { @@ -24,3 +27,58 @@ func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { b := k.cdc.MustMarshal(¶ms) store.Set([]byte(types.ParamsKey), b) } + +func (k Keeper) CheckBaseAssetExist(ctx sdk.Context, denom string) bool { + + params := k.GetParams(ctx) + + // We need to do this step because when initializing chain, usdc denom will be unknown until ibc is set up. + // Then adding usdc denom through gov proposal will take time, and we won't be able to open a pool until proposal gets executed + if len(params.BaseAssets) == 0 { + baseCurrencyDenom, found := k.assetProfileKeeper.GetUsdcDenom(ctx) + if found { + params.BaseAssets = []string{baseCurrencyDenom} + k.SetParams(ctx, params) + } + } + + found := false + for _, asset := range params.BaseAssets { + if asset == denom { + found = true + } + } + return found +} + +func (k Keeper) V8Migrate(ctx sdk.Context) error { + baseCurrencyDenom, found := k.assetProfileKeeper.GetUsdcDenom(ctx) + if !found { + return errorsmod.Wrapf(assetprofiletypes.ErrAssetProfileNotFound, "asset %s not found", ptypes.BaseCurrency) + } + + params := types.DefaultParams() + params.BaseAssets = []string{baseCurrencyDenom} + + k.SetParams(ctx, params) + + legacyPools := k.GetAllLegacyPool(ctx) + for _, legacyPool := range legacyPools { + var newPool types.Pool + newPool.PoolId = legacyPool.PoolId + newPool.Address = legacyPool.Address + newPool.PoolParams = types.PoolParams{ + SwapFee: legacyPool.PoolParams.SwapFee, + UseOracle: legacyPool.PoolParams.UseOracle, + FeeDenom: legacyPool.PoolParams.FeeDenom, + } + newPool.TotalShares = legacyPool.TotalShares + newPool.TotalWeight = legacyPool.TotalWeight + newPool.PoolAssets = legacyPool.PoolAssets + newPool.RebalanceTreasury = legacyPool.RebalanceTreasury + + k.SetPool(ctx, newPool) + } + + return nil +} diff --git a/x/amm/keeper/params_test.go b/x/amm/keeper/params_test.go index 0a7d2541d..31356d8c2 100644 --- a/x/amm/keeper/params_test.go +++ b/x/amm/keeper/params_test.go @@ -11,7 +11,7 @@ import ( func TestGetParams(t *testing.T) { k, ctx, _, _ := testkeeper.AmmKeeper(t) params := types.DefaultParams() - + params.BaseAssets = nil k.SetParams(ctx, params) require.EqualValues(t, params, k.GetParams(ctx)) diff --git a/x/amm/keeper/pool.go b/x/amm/keeper/pool.go index 91620857d..ade7008b7 100644 --- a/x/amm/keeper/pool.go +++ b/x/amm/keeper/pool.go @@ -21,6 +21,12 @@ func (k Keeper) SetPool(ctx sdk.Context, pool types.Pool) { store.Set(types.PoolKey(pool.PoolId), b) } +func (k Keeper) SetLegacyPool(ctx sdk.Context, pool types.LegacyPool) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.KeyPrefix(types.PoolKeyPrefix)) + b := k.cdc.MustMarshal(&pool) + store.Set(types.PoolKey(pool.PoolId), b) +} + // GetPool returns a pool from its index func (k Keeper) GetPool(ctx sdk.Context, poolId uint64) (val types.Pool, found bool) { store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), types.KeyPrefix(types.PoolKeyPrefix)) diff --git a/x/amm/keeper/pool_share_test.go b/x/amm/keeper/pool_share_test.go index b6125e1ae..5f754b6bf 100644 --- a/x/amm/keeper/pool_share_test.go +++ b/x/amm/keeper/pool_share_test.go @@ -54,15 +54,11 @@ func TestCommitMintedLPTokenToCommitmentModule(t *testing.T) { Token: sdk.NewCoin(ptypes.BaseCurrency, sdkmath.NewInt(10000)), }) - argSwapFee, err := sdkmath.LegacyNewDecFromStr("0.1") + argSwapFee, err := sdkmath.LegacyNewDecFromStr("0.01") require.NoError(t, err) - argExitFee, err := sdkmath.LegacyNewDecFromStr("0.1") - require.NoError(t, err) - - poolParams := &atypes.PoolParams{ + poolParams := atypes.PoolParams{ SwapFee: argSwapFee, - ExitFee: argExitFee, } msg := types.NewMsgCreatePool( diff --git a/x/amm/keeper/pool_test.go b/x/amm/keeper/pool_test.go index 388b869bc..7df5646e4 100644 --- a/x/amm/keeper/pool_test.go +++ b/x/amm/keeper/pool_test.go @@ -25,15 +25,9 @@ func createNPool(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Pool { items[i].TotalWeight = sdkmath.NewInt(100) items[i].TotalShares = sdk.NewCoin(types.GetPoolShareDenom(uint64(i)), types.OneShare) items[i].PoolParams = types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, } keeper.SetPool(ctx, items[i]) diff --git a/x/amm/keeper/query_exit_pool_estimation.go b/x/amm/keeper/query_exit_pool_estimation.go index c5755cee9..c9d732dcc 100644 --- a/x/amm/keeper/query_exit_pool_estimation.go +++ b/x/amm/keeper/query_exit_pool_estimation.go @@ -46,12 +46,11 @@ func (k Keeper) ExitPoolEst( return sdk.Coins{}, math.LegacyZeroDec(), errorsmod.Wrapf(types.ErrInvalidMathApprox, "Trying to exit a negative amount of shares") } - exitCoins, weightBalanceBonus, err = pool.CalcExitPoolCoinsFromShares(ctx, k.oracleKeeper, k.accountedPoolKeeper, shareInAmount, tokenOutDenom) + params := k.GetParams(ctx) + exitCoins, weightBalanceBonus, err = pool.CalcExitPoolCoinsFromShares(ctx, k.oracleKeeper, k.accountedPoolKeeper, shareInAmount, tokenOutDenom, params) if err != nil { return sdk.Coins{}, math.LegacyZeroDec(), err } - exitFeeCoins := PortionCoins(exitCoins, pool.PoolParams.ExitFee) - - return exitCoins.Sub(exitFeeCoins...), weightBalanceBonus, nil + return exitCoins, weightBalanceBonus, nil } diff --git a/x/amm/keeper/query_join_pool_estimation.go b/x/amm/keeper/query_join_pool_estimation.go index c8f676b74..6627d7642 100644 --- a/x/amm/keeper/query_join_pool_estimation.go +++ b/x/amm/keeper/query_join_pool_estimation.go @@ -50,9 +50,10 @@ func (k Keeper) JoinPoolEst( } } + params := k.GetParams(ctx) snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) cacheCtx, _ := ctx.CacheContext() - sharesOut, slippage, weightBalanceBonus, err = pool.JoinPool(cacheCtx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokensIn) + sharesOut, slippage, weightBalanceBonus, err = pool.JoinPool(cacheCtx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokensIn, params) if err != nil { return nil, math.ZeroInt(), math.LegacyZeroDec(), math.LegacyZeroDec(), err } @@ -60,10 +61,11 @@ func (k Keeper) JoinPoolEst( return tokensIn, sharesOut, slippage, weightBalanceBonus, err } + params := k.GetParams(ctx) // on oracle pool, full tokenInMaxs are used regardless shareOutAmount snapshot := k.GetAccountedPoolSnapshotOrSet(ctx, pool) cacheCtx, _ := ctx.CacheContext() - sharesOut, slippage, weightBalanceBonus, err = pool.JoinPool(cacheCtx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokenInMaxs) + sharesOut, slippage, weightBalanceBonus, err = pool.JoinPool(cacheCtx, &snapshot, k.oracleKeeper, k.accountedPoolKeeper, tokenInMaxs, params) if err != nil { return nil, math.ZeroInt(), math.LegacyZeroDec(), math.LegacyZeroDec(), err } diff --git a/x/amm/keeper/query_test.go b/x/amm/keeper/query_test.go index dbc1dade9..2b9957029 100644 --- a/x/amm/keeper/query_test.go +++ b/x/amm/keeper/query_test.go @@ -20,7 +20,7 @@ func (suite *AmmKeeperTestSuite) TestQuery() { }, func() { params := types.DefaultParams() - + params.BaseAssets = nil response, err := suite.app.AmmKeeper.Params(suite.ctx, &types.QueryParamsRequest{}) suite.Require().NoError(err) suite.Require().Equal(&types.QueryParamsResponse{Params: params}, response) diff --git a/x/amm/keeper/route_exact_amount_in_test.go b/x/amm/keeper/route_exact_amount_in_test.go index 48e693e20..5a7a7eb92 100644 --- a/x/amm/keeper/route_exact_amount_in_test.go +++ b/x/amm/keeper/route_exact_amount_in_test.go @@ -157,9 +157,8 @@ func (suite *AmmKeeperTestSuite) TestRouteExactAmountIn() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - SwapFee: tc.swapFeeIn, - FeeDenom: ptypes.BaseCurrency, - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% + SwapFee: tc.swapFeeIn, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/keeper/swap_in_amt_given_out.go b/x/amm/keeper/swap_in_amt_given_out.go index c30a5fcad..8f44cf635 100644 --- a/x/amm/keeper/swap_in_amt_given_out.go +++ b/x/amm/keeper/swap_in_amt_given_out.go @@ -19,6 +19,6 @@ func (k Keeper) SwapInAmtGivenOut( if !found { return sdk.Coin{}, math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec(), fmt.Errorf("invalid pool: %d", poolId) } - - return ammPool.SwapInAmtGivenOut(ctx, oracleKeeper, snapshot, tokensOut, tokenInDenom, swapFee, k.accountedPoolKeeper, weightBreakingFeePerpetualFactor) + params := k.GetParams(ctx) + return ammPool.SwapInAmtGivenOut(ctx, oracleKeeper, snapshot, tokensOut, tokenInDenom, swapFee, k.accountedPoolKeeper, weightBreakingFeePerpetualFactor, params) } diff --git a/x/amm/keeper/swap_out_amt_given_in.go b/x/amm/keeper/swap_out_amt_given_in.go index d85f8054f..e153a89ab 100644 --- a/x/amm/keeper/swap_out_amt_given_in.go +++ b/x/amm/keeper/swap_out_amt_given_in.go @@ -22,6 +22,6 @@ func (k Keeper) SwapOutAmtGivenIn( if !found { return sdk.Coin{}, sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), sdkmath.LegacyZeroDec(), fmt.Errorf("invalid pool: %d", poolId) } - - return ammPool.SwapOutAmtGivenIn(ctx, oracleKeeper, snapshot, tokensIn, tokenOutDenom, swapFee, k.accountedPoolKeeper, weightBreakingFeePerpetualFactor) + params := k.GetParams(ctx) + return ammPool.SwapOutAmtGivenIn(ctx, oracleKeeper, snapshot, tokensIn, tokenOutDenom, swapFee, k.accountedPoolKeeper, weightBreakingFeePerpetualFactor, params) } diff --git a/x/amm/keeper/update_pool_for_swap_test.go b/x/amm/keeper/update_pool_for_swap_test.go index b1ba5b7ef..4d081208e 100644 --- a/x/amm/keeper/update_pool_for_swap_test.go +++ b/x/amm/keeper/update_pool_for_swap_test.go @@ -150,14 +150,9 @@ func (suite *AmmKeeperTestSuite) TestUpdatePoolForSwap() { Address: types.NewPoolAddress(1).String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: []types.PoolAsset{ diff --git a/x/amm/migrations/v3_migration.go b/x/amm/migrations/v3_migration.go index cffcad71e..a0f3d4716 100644 --- a/x/amm/migrations/v3_migration.go +++ b/x/amm/migrations/v3_migration.go @@ -1,17 +1,9 @@ package migrations import ( - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) func (m Migrator) V3Migration(ctx sdk.Context) error { - pools := m.keeper.GetAllPool(ctx) - for _, pool := range pools { - if pool.PoolParams.UseOracle { - pool.PoolParams.WeightBreakingFeeMultiplier = sdkmath.LegacyNewDecWithPrec(5, 4) // 0.05% - m.keeper.SetPool(ctx, pool) - } - } return nil } diff --git a/x/amm/migrations/v6_migration.go b/x/amm/migrations/v6_migration.go index e85776b73..abd611cfe 100644 --- a/x/amm/migrations/v6_migration.go +++ b/x/amm/migrations/v6_migration.go @@ -1,40 +1,10 @@ package migrations import ( - "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/elys-network/elys/x/amm/types" ) func (m Migrator) V6Migration(ctx sdk.Context) error { - pools := m.keeper.GetAllLegacyPool(ctx) - for _, pool := range pools { - newPoolAssets := []types.PoolAsset{} - for _, poolAsset := range pool.PoolAssets { - newPoolAssets = append(newPoolAssets, types.PoolAsset{Token: poolAsset.Token, Weight: poolAsset.Weight, ExternalLiquidityRatio: math.LegacyOneDec()}) - } - newPool := types.Pool{ - PoolId: pool.PoolId, - Address: pool.Address, - PoolParams: types.PoolParams{ - SwapFee: pool.PoolParams.SwapFee, - ExitFee: pool.PoolParams.ExitFee, - UseOracle: pool.PoolParams.UseOracle, - WeightBreakingFeeMultiplier: pool.PoolParams.WeightBreakingFeeMultiplier, - WeightBreakingFeeExponent: pool.PoolParams.WeightBreakingFeeExponent, - WeightRecoveryFeePortion: pool.PoolParams.WeightRecoveryFeePortion, - ThresholdWeightDifference: pool.PoolParams.ThresholdWeightDifference, - WeightBreakingFeePortion: pool.PoolParams.WeightBreakingFeePortion, - FeeDenom: pool.PoolParams.FeeDenom, - }, - TotalShares: pool.TotalShares, - PoolAssets: newPoolAssets, - TotalWeight: pool.TotalWeight, - RebalanceTreasury: pool.RebalanceTreasury, - } - m.keeper.RemovePool(ctx, pool.PoolId) - m.keeper.SetPool(ctx, newPool) - } return nil } diff --git a/x/amm/migrations/v7_migration.go b/x/amm/migrations/v7_migration.go index 26f3eba0d..528768b26 100644 --- a/x/amm/migrations/v7_migration.go +++ b/x/amm/migrations/v7_migration.go @@ -9,7 +9,7 @@ import ( ) func (m Migrator) V7Migration(ctx sdk.Context) error { - pools := m.keeper.GetAllPool(ctx) + pools := m.keeper.GetAllLegacyPool(ctx) for _, pool := range pools { newPoolAddress := types.NewPoolAddress(pool.PoolId) poolAccountModuleName := types.GetPoolIdModuleName(pool.PoolId) @@ -19,7 +19,10 @@ func (m Migrator) V7Migration(ctx sdk.Context) error { poolAccAddress := sdk.MustAccAddressFromBech32(pool.Address) // Bank: Transfer funds from prevPoolAddress to new newPoolAddress prevPoolAddressBalances := m.keeper.GetBankKeeper().GetAllBalances(ctx, poolAccAddress) - m.keeper.GetBankKeeper().SendCoins(ctx, poolAccAddress, newPoolAddress, prevPoolAddressBalances) + err := m.keeper.GetBankKeeper().SendCoins(ctx, poolAccAddress, newPoolAddress, prevPoolAddressBalances) + if err != nil { + return err + } // AssetProfile: Update authority in assetprofile entry poolBaseDenom := types.GetPoolShareDenom(pool.PoolId) @@ -35,7 +38,7 @@ func (m Migrator) V7Migration(ctx sdk.Context) error { pool.Address = newPoolAddress.String() - m.keeper.SetPool(ctx, pool) + m.keeper.SetLegacyPool(ctx, pool) // Update the name and Symbol of pool share token metadata metadata, found := m.keeper.GetBankKeeper().GetDenomMetaData(ctx, poolBaseDenom) diff --git a/x/amm/migrations/v8_migration.go b/x/amm/migrations/v8_migration.go new file mode 100644 index 000000000..1eeb23539 --- /dev/null +++ b/x/amm/migrations/v8_migration.go @@ -0,0 +1,9 @@ +package migrations + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func (m Migrator) V8Migration(ctx sdk.Context) error { + return m.keeper.V8Migrate(ctx) +} diff --git a/x/amm/module.go b/x/amm/module.go index 0c4480dae..b0e06c131 100644 --- a/x/amm/module.go +++ b/x/amm/module.go @@ -136,6 +136,10 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { if err != nil { panic(err) } + err = cfg.RegisterMigration(types.ModuleName, 7, m.V8Migration) + if err != nil { + panic(err) + } } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted) @@ -159,7 +163,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion is a sequence number for state-breaking change of the module. It should be incremented on each consensus-breaking change introduced by the module. To avoid wrong/empty versions, the initial version should be set to 1 -func (AppModule) ConsensusVersion() uint64 { return 7 } +func (AppModule) ConsensusVersion() uint64 { return 8 } // BeginBlock contains the logic that is automatically triggered at the beginning of each block func (am AppModule) BeginBlock(_ context.Context) error { diff --git a/x/amm/types/calc_exit_pool.go b/x/amm/types/calc_exit_pool.go index 3ee7046ce..0b88febae 100644 --- a/x/amm/types/calc_exit_pool.go +++ b/x/amm/types/calc_exit_pool.go @@ -87,6 +87,7 @@ func CalcExitPool( accountedPoolKeeper AccountedPoolKeeper, exitingShares sdkmath.Int, tokenOutDenom string, + params Params, ) (exitCoins sdk.Coins, weightBalanceBonus sdkmath.LegacyDec, err error) { totalShares := pool.GetTotalShares() if exitingShares.GTE(totalShares.Amount) { @@ -142,7 +143,7 @@ func CalcExitPool( // weight breaking fee as in Plasma pool weightOut := GetDenomOracleAssetWeight(ctx, pool.PoolId, oracleKeeper, newAssetPools, tokenOutDenom) weightIn := sdkmath.LegacyOneDec().Sub(weightOut) - weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, pool.PoolParams, distanceDiff) + weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, distanceDiff, params) tokenOutAmount := oracleOutAmount.Mul(sdkmath.LegacyOneDec().Sub(weightBreakingFee)).RoundInt() return sdk.Coins{sdk.NewCoin(tokenOutDenom, tokenOutAmount)}, weightBreakingFee.Neg(), nil diff --git a/x/amm/types/errors.go b/x/amm/types/errors.go index 64e617c65..3e242f210 100644 --- a/x/amm/types/errors.go +++ b/x/amm/types/errors.go @@ -4,6 +4,7 @@ package types import ( "cosmossdk.io/errors" + "fmt" ) // x/amm module sentinel errors @@ -17,8 +18,7 @@ var ( ErrEmptyRoutes = errors.Register(ModuleName, 21, "routes not defined") ErrNegativeSwapFee = errors.Register(ModuleName, 23, "swap fee is negative") ErrNegativeExitFee = errors.Register(ModuleName, 24, "exit fee is negative") - ErrTooMuchSwapFee = errors.Register(ModuleName, 25, "swap fee should be less than 1 (100%)") - ErrTooMuchExitFee = errors.Register(ModuleName, 26, "exit fee should be less than 1 (100%)") + ErrTooMuchSwapFee = errors.Register(ModuleName, 25, fmt.Sprintf("swap fee should be less than %s (%s %%)", MaxSwapFee.String(), MaxSwapFee.MulInt64(100).String())) ErrTooManyTokensOut = errors.Register(ModuleName, 31, "tx is trying to get more tokens out of the pool than exist") @@ -33,13 +33,9 @@ var ( ErrInitialSpotPriceIsZero = errors.Register(ModuleName, 106, "initial spot price is zero") ErrSpotPriceIsZero = errors.Register(ModuleName, 107, "spot price is zero") - ErrPoolParamsShouldNotBeNil = errors.Register(ModuleName, 108, "pool params should not be nil") - ErrSwapFeeShouldNotExceedTwoPercent = errors.Register(ModuleName, 109, "swap fee should not exceed 2%") - ErrExitFeeShouldNotExceedTwoPercent = errors.Register(ModuleName, 110, "exit fee should not exceed 2%") - ErrFeeShouldNotBeNegative = errors.Register(ModuleName, 111, "fee should not be negative") - ErrInvalidShareAmountOut = errors.Register(ModuleName, 112, "invalid share amount out") - ErrPoolAssetsMustBeTwo = errors.Register(ModuleName, 113, "pool assets must be exactly two") - ErrOnlyBaseCurrencyPoolAllowed = errors.Register(ModuleName, 114, "Only USDC paired pool allowed") + ErrInvalidShareAmountOut = errors.Register(ModuleName, 112, "invalid share amount out") + ErrPoolAssetsMustBeTwo = errors.Register(ModuleName, 113, "pool assets must be exactly two") + ErrOnlyBaseAssetsPoolAllowed = errors.Register(ModuleName, 114, "Only base assets paired pool allowed") ) const ( diff --git a/x/amm/types/errors_test.go b/x/amm/types/errors_test.go index 3a6e67126..e9abe42c0 100644 --- a/x/amm/types/errors_test.go +++ b/x/amm/types/errors_test.go @@ -16,8 +16,7 @@ func TestErrors(t *testing.T) { require.Equal(t, types.ErrEmptyRoutes.Error(), "routes not defined") require.Equal(t, types.ErrNegativeSwapFee.Error(), "swap fee is negative") require.Equal(t, types.ErrNegativeExitFee.Error(), "exit fee is negative") - require.Equal(t, types.ErrTooMuchSwapFee.Error(), "swap fee should be less than 1 (100%)") - require.Equal(t, types.ErrTooMuchExitFee.Error(), "exit fee should be less than 1 (100%)") + require.Equal(t, types.ErrTooMuchSwapFee.Error(), "swap fee should be less than 0.020000000000000000 (2.000000000000000000 %)") require.Equal(t, types.ErrTooManyTokensOut.Error(), "tx is trying to get more tokens out of the pool than exist") require.Equal(t, types.ErrInvalidPoolId.Error(), "invalid pool id") } diff --git a/x/amm/types/message_create_pool.go b/x/amm/types/message_create_pool.go index defbe9d04..af355ca70 100644 --- a/x/amm/types/message_create_pool.go +++ b/x/amm/types/message_create_pool.go @@ -2,14 +2,14 @@ package types import ( errorsmod "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var _ sdk.Msg = &MsgCreatePool{} +var _ sdk.HasValidateBasic = &MsgCreatePool{} -func NewMsgCreatePool(sender string, poolParams *PoolParams, poolAssets []PoolAsset) *MsgCreatePool { +func NewMsgCreatePool(sender string, poolParams PoolParams, poolAssets []PoolAsset) *MsgCreatePool { return &MsgCreatePool{ Sender: sender, PoolParams: poolParams, @@ -27,24 +27,14 @@ func (msg *MsgCreatePool) ValidateBasic() error { return ErrPoolAssetsMustBeTwo } - if msg.PoolParams == nil { - return ErrPoolParamsShouldNotBeNil + if err = msg.PoolParams.Validate(); err != nil { + return err } - if msg.PoolParams.SwapFee.IsNegative() { - return ErrFeeShouldNotBeNegative - } - - if msg.PoolParams.SwapFee.GT(sdkmath.LegacyNewDecWithPrec(2, 2)) { // >2% - return ErrSwapFeeShouldNotExceedTwoPercent - } - - if msg.PoolParams.ExitFee.IsNegative() { - return ErrFeeShouldNotBeNegative - } - - if msg.PoolParams.ExitFee.GT(sdkmath.LegacyNewDecWithPrec(2, 2)) { // >2% - return ErrExitFeeShouldNotExceedTwoPercent + for _, asset := range msg.PoolAssets { + if err = asset.Validate(); err != nil { + return err + } } return nil diff --git a/x/amm/types/message_create_pool_test.go b/x/amm/types/message_create_pool_test.go index 5d774098d..7fe57a709 100644 --- a/x/amm/types/message_create_pool_test.go +++ b/x/amm/types/message_create_pool_test.go @@ -22,15 +22,10 @@ func TestMsgCreatePool_ValidateBasic(t *testing.T) { name: "invalid address", msg: types.MsgCreatePool{ Sender: "invalid_address", - PoolParams: &types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + PoolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, }, err: sdkerrors.ErrInvalidAddress, @@ -39,15 +34,10 @@ func TestMsgCreatePool_ValidateBasic(t *testing.T) { name: "pool assets must be exactly two", msg: types.MsgCreatePool{ Sender: sample.AccAddress(), - PoolParams: &types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + PoolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, PoolAssets: []types.PoolAsset{ { @@ -62,24 +52,21 @@ func TestMsgCreatePool_ValidateBasic(t *testing.T) { name: "valid address", msg: types.MsgCreatePool{ Sender: sample.AccAddress(), - PoolParams: &types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + PoolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, PoolAssets: []types.PoolAsset{ { - Token: sdk.NewCoin("uusdc", sdkmath.NewInt(10000000)), - Weight: sdkmath.NewInt(10), + Token: sdk.NewCoin("uusdc", sdkmath.NewInt(10000000)), + Weight: sdkmath.NewInt(10), + ExternalLiquidityRatio: sdkmath.LegacyOneDec(), }, { - Token: sdk.NewCoin("uatom", sdkmath.NewInt(10000000)), - Weight: sdkmath.NewInt(10), + Token: sdk.NewCoin("uatom", sdkmath.NewInt(10000000)), + Weight: sdkmath.NewInt(10), + ExternalLiquidityRatio: sdkmath.LegacyOneDec(), }, }, }, diff --git a/x/amm/types/message_exit_pool.go b/x/amm/types/message_exit_pool.go index ac5ca9678..efff45f36 100644 --- a/x/amm/types/message_exit_pool.go +++ b/x/amm/types/message_exit_pool.go @@ -24,6 +24,12 @@ func (msg *MsgExitPool) ValidateBasic() error { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } + for _, coin := range msg.MinAmountsOut { + if err = coin.Validate(); err != nil { + return err + } + } + if msg.ShareAmountIn.IsNil() { return ErrInvalidShareAmountOut } diff --git a/x/amm/types/message_feed_multiple_external_liquidity.go b/x/amm/types/message_feed_multiple_external_liquidity.go index 246415084..721628c48 100644 --- a/x/amm/types/message_feed_multiple_external_liquidity.go +++ b/x/amm/types/message_feed_multiple_external_liquidity.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -19,5 +20,19 @@ func (msg *MsgFeedMultipleExternalLiquidity) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } + + for _, liquidity := range msg.Liquidity { + for _, depthInfo := range liquidity.AmountDepthInfo { + if err = sdk.ValidateDenom(depthInfo.Asset); err != nil { + return err + } + if depthInfo.Depth.IsNil() || depthInfo.Depth.IsNegative() { + return fmt.Errorf("depth cannot be negative or nil") + } + if depthInfo.Amount.IsNil() || depthInfo.Amount.IsNegative() { + return fmt.Errorf("depth amount cannot be negative or nil") + } + } + } return nil } diff --git a/x/amm/types/message_join_pool.go b/x/amm/types/message_join_pool.go index af3fe4cd6..e09776f65 100644 --- a/x/amm/types/message_join_pool.go +++ b/x/amm/types/message_join_pool.go @@ -32,5 +32,11 @@ func (msg *MsgJoinPool) ValidateBasic() error { return ErrInvalidShareAmountOut } + for _, coin := range msg.MaxAmountsIn { + if err = coin.Validate(); err != nil { + return err + } + } + return nil } diff --git a/x/amm/types/message_swap_by_denom.go b/x/amm/types/message_swap_by_denom.go index cb997c3fb..3a11386c4 100644 --- a/x/amm/types/message_swap_by_denom.go +++ b/x/amm/types/message_swap_by_denom.go @@ -2,6 +2,7 @@ package types import ( errorsmod "cosmossdk.io/errors" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -25,5 +26,22 @@ func (msg *MsgSwapByDenom) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } + if msg.Recipient != "" { + if _, err = sdk.AccAddressFromBech32(msg.Recipient); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + } + } + if err = msg.Amount.Validate(); err != nil { + return err + } + if err = sdk.ValidateDenom(msg.DenomIn); err != nil { + return err + } + if err = sdk.ValidateDenom(msg.DenomOut); err != nil { + return err + } + if msg.DenomIn == msg.DenomOut { + return fmt.Errorf("demom in cannot be same as denom out") + } return nil } diff --git a/x/amm/types/message_swap_by_denom_test.go b/x/amm/types/message_swap_by_denom_test.go index 4b9740a9c..f6d01a842 100644 --- a/x/amm/types/message_swap_by_denom_test.go +++ b/x/amm/types/message_swap_by_denom_test.go @@ -1,6 +1,8 @@ package types import ( + sdk "github.com/cosmos/cosmos-sdk/types" + ptypes "github.com/elys-network/elys/x/parameter/types" "testing" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -23,7 +25,10 @@ func TestMsgSwapByDenom_ValidateBasic(t *testing.T) { }, { name: "valid address", msg: MsgSwapByDenom{ - Sender: sample.AccAddress(), + Sender: sample.AccAddress(), + Amount: sdk.NewInt64Coin(ptypes.ATOM, 10), + DenomIn: ptypes.ATOM, + DenomOut: ptypes.BaseCurrency, }, }, } diff --git a/x/amm/types/message_swap_exact_amount_in.go b/x/amm/types/message_swap_exact_amount_in.go index 8a1fa3fa7..464bb2df8 100644 --- a/x/amm/types/message_swap_exact_amount_in.go +++ b/x/amm/types/message_swap_exact_amount_in.go @@ -3,6 +3,7 @@ package types import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -37,5 +38,21 @@ func (msg *MsgSwapExactAmountIn) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } + if msg.Recipient != "" { + if _, err = sdk.AccAddressFromBech32(msg.Recipient); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + } + } + for _, route := range msg.Routes { + if err = sdk.ValidateDenom(route.TokenOutDenom); err != nil { + return err + } + } + if err = msg.TokenIn.Validate(); err != nil { + return err + } + if msg.TokenIn.IsZero() { + return fmt.Errorf("token in is zero") + } return nil } diff --git a/x/amm/types/message_swap_exact_amount_in_test.go b/x/amm/types/message_swap_exact_amount_in_test.go index 284e3f657..3de28ffe4 100644 --- a/x/amm/types/message_swap_exact_amount_in_test.go +++ b/x/amm/types/message_swap_exact_amount_in_test.go @@ -1,6 +1,9 @@ package types_test import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + ptypes "github.com/elys-network/elys/x/parameter/types" "testing" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -24,7 +27,11 @@ func TestMsgSwapExactAmountIn_ValidateBasic(t *testing.T) { }, { name: "valid address", msg: types.MsgSwapExactAmountIn{ - Sender: sample.AccAddress(), + Sender: sample.AccAddress(), + Routes: nil, + TokenIn: sdk.Coin{ptypes.ATOM, math.NewInt(10)}, + TokenOutMinAmount: math.NewInt(10), + Recipient: "", }, }, } diff --git a/x/amm/types/message_swap_exact_amount_out.go b/x/amm/types/message_swap_exact_amount_out.go index 0d6d736f0..b00bc347a 100644 --- a/x/amm/types/message_swap_exact_amount_out.go +++ b/x/amm/types/message_swap_exact_amount_out.go @@ -3,6 +3,7 @@ package types import ( errorsmod "cosmossdk.io/errors" sdkmath "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -37,5 +38,21 @@ func (msg *MsgSwapExactAmountOut) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } + if msg.Recipient != "" { + if _, err = sdk.AccAddressFromBech32(msg.Recipient); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid recipient address (%s)", err) + } + } + for _, route := range msg.Routes { + if err = sdk.ValidateDenom(route.TokenInDenom); err != nil { + return err + } + } + if err = msg.TokenOut.Validate(); err != nil { + return err + } + if msg.TokenOut.IsZero() { + return fmt.Errorf("token in is zero") + } return nil } diff --git a/x/amm/types/message_swap_exact_amount_out_test.go b/x/amm/types/message_swap_exact_amount_out_test.go index 0e7702824..8679173c7 100644 --- a/x/amm/types/message_swap_exact_amount_out_test.go +++ b/x/amm/types/message_swap_exact_amount_out_test.go @@ -1,6 +1,9 @@ package types_test import ( + "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + ptypes "github.com/elys-network/elys/x/parameter/types" "testing" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -24,7 +27,11 @@ func TestMsgSwapExactAmountOut_ValidateBasic(t *testing.T) { }, { name: "valid address", msg: types.MsgSwapExactAmountOut{ - Sender: sample.AccAddress(), + Sender: sample.AccAddress(), + Routes: nil, + TokenOut: sdk.Coin{ptypes.ATOM, math.NewInt(10)}, + TokenInMaxAmount: math.NewInt(1), + Recipient: "", }, }, } diff --git a/x/amm/types/message_update_params.go b/x/amm/types/message_update_params.go index 85ea604ad..c78d7b297 100644 --- a/x/amm/types/message_update_params.go +++ b/x/amm/types/message_update_params.go @@ -21,5 +21,8 @@ func (msg *MsgUpdateParams) ValidateBasic() error { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } + if err = msg.Params.Validate(); err != nil { + return err + } return nil } diff --git a/x/amm/types/message_update_pool_params.go b/x/amm/types/message_update_pool_params.go index 4b4d0e0ca..3ca47a5b0 100644 --- a/x/amm/types/message_update_pool_params.go +++ b/x/amm/types/message_update_pool_params.go @@ -2,14 +2,14 @@ package types import ( errorsmod "cosmossdk.io/errors" - sdkmath "cosmossdk.io/math" + "fmt" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) var _ sdk.Msg = &MsgUpdatePoolParams{} -func NewMsgUpdatePoolParams(authority string, poolId uint64, poolParams *PoolParams) *MsgUpdatePoolParams { +func NewMsgUpdatePoolParams(authority string, poolId uint64, poolParams PoolParams) *MsgUpdatePoolParams { return &MsgUpdatePoolParams{ Authority: authority, PoolId: poolId, @@ -23,24 +23,12 @@ func (msg *MsgUpdatePoolParams) ValidateBasic() error { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid sender address (%s)", err) } - if msg.PoolParams == nil { - return ErrPoolParamsShouldNotBeNil + if msg.PoolId == 0 { + return fmt.Errorf("invalid pool id: %d", msg.PoolId) } - if msg.PoolParams.SwapFee.IsNegative() { - return ErrFeeShouldNotBeNegative - } - - if msg.PoolParams.SwapFee.GT(sdkmath.LegacyNewDecWithPrec(2, 2)) { // >2% - return ErrSwapFeeShouldNotExceedTwoPercent - } - - if msg.PoolParams.ExitFee.IsNegative() { - return ErrFeeShouldNotBeNegative - } - - if msg.PoolParams.ExitFee.GT(sdkmath.LegacyNewDecWithPrec(2, 2)) { // >2% - return ErrExitFeeShouldNotExceedTwoPercent + if err = msg.PoolParams.Validate(); err != nil { + return err } return nil diff --git a/x/amm/types/message_update_pool_params_test.go b/x/amm/types/message_update_pool_params_test.go index c27f0c99f..b7964ea5f 100644 --- a/x/amm/types/message_update_pool_params_test.go +++ b/x/amm/types/message_update_pool_params_test.go @@ -21,15 +21,10 @@ func TestMsgUpdatePoolParams_ValidateBasic(t *testing.T) { name: "invalid address", msg: types.MsgUpdatePoolParams{ Authority: "invalid_address", - PoolParams: &types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + PoolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, }, err: sdkerrors.ErrInvalidAddress, @@ -37,15 +32,11 @@ func TestMsgUpdatePoolParams_ValidateBasic(t *testing.T) { name: "valid address", msg: types.MsgUpdatePoolParams{ Authority: sample.AccAddress(), - PoolParams: &types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + PoolId: 1, + PoolParams: types.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, }, }, }, diff --git a/x/amm/types/new_balancer_pool.go b/x/amm/types/new_balancer_pool.go index f0c82a0f7..50b36b57b 100644 --- a/x/amm/types/new_balancer_pool.go +++ b/x/amm/types/new_balancer_pool.go @@ -17,7 +17,7 @@ func NewBalancerPool(poolId uint64, balancerPoolParams PoolParams, assets []Pool poolAddr := NewPoolAddress(poolId) poolRebalanceTreasuryAddr := NewPoolRebalanceTreasury(poolId) - // pool thats created up to ensuring the assets and params are valid. + // pool that's created up to ensuring the assets and params are valid. // We assume that FuturePoolGovernor is valid. pool := &Pool{ PoolId: poolId, @@ -35,7 +35,7 @@ func NewBalancerPool(poolId uint64, balancerPoolParams PoolParams, assets []Pool } sortedPoolAssets := pool.GetAllPoolAssets() - err = balancerPoolParams.Validate(sortedPoolAssets) + err = balancerPoolParams.Validate() if err != nil { return Pool{}, err } diff --git a/x/amm/types/params.go b/x/amm/types/params.go index 84ddc3f53..b341da7de 100644 --- a/x/amm/types/params.go +++ b/x/amm/types/params.go @@ -3,14 +3,23 @@ package types import ( "cosmossdk.io/math" "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" ) // NewParams creates a new Params instance -func NewParams(poolCreationFee math.Int, slippageTrackDuration uint64, enable bool) Params { +func NewParams(poolCreationFee math.Int, slippageTrackDuration uint64, baseAssets []string) Params { return Params{ - PoolCreationFee: poolCreationFee, - SlippageTrackDuration: slippageTrackDuration, - EnableBaseCurrencyPairedPoolOnly: enable, + PoolCreationFee: poolCreationFee, + SlippageTrackDuration: slippageTrackDuration, + BaseAssets: baseAssets, + WeightBreakingFeeExponent: math.LegacyMustNewDecFromStr("2.5"), + WeightBreakingFeeMultiplier: math.LegacyMustNewDecFromStr("0.0005"), + WeightBreakingFeePortion: math.LegacyMustNewDecFromStr("0.5"), + WeightRecoveryFeePortion: math.LegacyMustNewDecFromStr("0.1"), + ThresholdWeightDifference: math.LegacyMustNewDecFromStr("0.3"), + AllowedPoolCreators: []string{authtypes.NewModuleAddress(govtypes.ModuleName).String()}, } } @@ -19,7 +28,7 @@ func DefaultParams() Params { return NewParams( math.NewInt(10_000_000), // 10 ELYS 86400*7, - false, + []string{}, ) } @@ -31,5 +40,55 @@ func (p Params) Validate() error { if p.PoolCreationFee.IsNegative() { return fmt.Errorf("pool creation fee must be positive") } + + for _, asset := range p.BaseAssets { + if err := sdk.ValidateDenom(asset); err != nil { + return err + } + } + + if p.WeightBreakingFeeExponent.IsNil() { + return fmt.Errorf("weightBreakingFeeExponent must not be empty") + } + if p.WeightBreakingFeeExponent.IsNegative() { + return fmt.Errorf("weightBreakingFeeExponent must be positive") + } + + if p.WeightBreakingFeeMultiplier.IsNil() { + return fmt.Errorf("weightBreakingFeeMultiplier must not be empty") + } + if p.WeightBreakingFeeMultiplier.IsNegative() { + return fmt.Errorf("weightBreakingFeeMultiplier must be positive") + } + + if p.WeightBreakingFeePortion.IsNil() { + return fmt.Errorf("weightBreakingFeePortion must not be empty") + } + if p.WeightBreakingFeePortion.IsNegative() { + return fmt.Errorf("weightBreakingFeePortion must be positive") + } + + if p.WeightRecoveryFeePortion.IsNil() { + return fmt.Errorf("weightRecoveryFeePortion must not be empty") + } + if p.WeightRecoveryFeePortion.IsNegative() { + return fmt.Errorf("weightRecoveryFeePortion must be positive") + } + + if p.ThresholdWeightDifference.IsNil() { + return fmt.Errorf("thresholdWeightDifference must not be empty") + } + if p.ThresholdWeightDifference.IsNegative() { + return fmt.Errorf("thresholdWeightDifference must be positive") + } return nil } + +func (p Params) IsCreatorAllowed(creator string) bool { + for _, allowedCreator := range p.AllowedPoolCreators { + if allowedCreator == creator { + return true + } + } + return false +} diff --git a/x/amm/types/params.pb.go b/x/amm/types/params.pb.go index 377f129b9..8ee7ce417 100644 --- a/x/amm/types/params.pb.go +++ b/x/amm/types/params.pb.go @@ -26,17 +26,76 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the module. -type Params struct { +type LegacyParams struct { PoolCreationFee cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3,customtype=cosmossdk.io/math.Int" json:"pool_creation_fee"` SlippageTrackDuration uint64 `protobuf:"varint,2,opt,name=slippage_track_duration,json=slippageTrackDuration,proto3" json:"slippage_track_duration,omitempty"` EnableBaseCurrencyPairedPoolOnly bool `protobuf:"varint,3,opt,name=enable_base_currency_paired_pool_only,json=enableBaseCurrencyPairedPoolOnly,proto3" json:"enable_base_currency_paired_pool_only,omitempty"` } +func (m *LegacyParams) Reset() { *m = LegacyParams{} } +func (m *LegacyParams) String() string { return proto.CompactTextString(m) } +func (*LegacyParams) ProtoMessage() {} +func (*LegacyParams) Descriptor() ([]byte, []int) { + return fileDescriptor_1209ca218537a425, []int{0} +} +func (m *LegacyParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *LegacyParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_LegacyParams.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 *LegacyParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_LegacyParams.Merge(m, src) +} +func (m *LegacyParams) XXX_Size() int { + return m.Size() +} +func (m *LegacyParams) XXX_DiscardUnknown() { + xxx_messageInfo_LegacyParams.DiscardUnknown(m) +} + +var xxx_messageInfo_LegacyParams proto.InternalMessageInfo + +func (m *LegacyParams) GetSlippageTrackDuration() uint64 { + if m != nil { + return m.SlippageTrackDuration + } + return 0 +} + +func (m *LegacyParams) GetEnableBaseCurrencyPairedPoolOnly() bool { + if m != nil { + return m.EnableBaseCurrencyPairedPoolOnly + } + return false +} + +type Params struct { + PoolCreationFee cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=pool_creation_fee,json=poolCreationFee,proto3,customtype=cosmossdk.io/math.Int" json:"pool_creation_fee"` + SlippageTrackDuration uint64 `protobuf:"varint,2,opt,name=slippage_track_duration,json=slippageTrackDuration,proto3" json:"slippage_track_duration,omitempty"` + BaseAssets []string `protobuf:"bytes,3,rep,name=base_assets,json=baseAssets,proto3" json:"base_assets,omitempty"` + WeightBreakingFeeExponent cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=weight_breaking_fee_exponent,json=weightBreakingFeeExponent,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_exponent"` + WeightBreakingFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=weight_breaking_fee_multiplier,json=weightBreakingFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_multiplier"` + WeightBreakingFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_portion"` + WeightRecoveryFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_recovery_fee_portion"` + ThresholdWeightDifference cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"threshold_weight_difference"` + AllowedPoolCreators []string `protobuf:"bytes,9,rep,name=allowed_pool_creators,json=allowedPoolCreators,proto3" json:"allowed_pool_creators,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_1209ca218537a425, []int{0} + return fileDescriptor_1209ca218537a425, []int{1} } func (m *Params) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -72,45 +131,66 @@ func (m *Params) GetSlippageTrackDuration() uint64 { return 0 } -func (m *Params) GetEnableBaseCurrencyPairedPoolOnly() bool { +func (m *Params) GetBaseAssets() []string { if m != nil { - return m.EnableBaseCurrencyPairedPoolOnly + return m.BaseAssets } - return false + return nil +} + +func (m *Params) GetAllowedPoolCreators() []string { + if m != nil { + return m.AllowedPoolCreators + } + return nil } func init() { + proto.RegisterType((*LegacyParams)(nil), "elys.amm.LegacyParams") proto.RegisterType((*Params)(nil), "elys.amm.Params") } func init() { proto.RegisterFile("elys/amm/params.proto", fileDescriptor_1209ca218537a425) } var fileDescriptor_1209ca218537a425 = []byte{ - // 324 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0xc1, 0x4a, 0xeb, 0x40, - 0x14, 0x86, 0x33, 0xf7, 0x4a, 0xa9, 0xd9, 0x88, 0xc1, 0x62, 0xed, 0x22, 0x0d, 0x82, 0x10, 0x90, - 0x26, 0x0b, 0xc1, 0x07, 0x48, 0x45, 0xe8, 0xaa, 0xa5, 0x08, 0x82, 0x9b, 0x61, 0x92, 0x1e, 0xd3, - 0xd0, 0xcc, 0x9c, 0x61, 0x66, 0x8a, 0xe6, 0x2d, 0x7c, 0x18, 0x1f, 0xa2, 0xcb, 0xe2, 0x4a, 0x5c, - 0x14, 0x69, 0x77, 0x3e, 0x85, 0x64, 0x12, 0x77, 0x73, 0xce, 0xf7, 0xcf, 0xc7, 0xe1, 0x77, 0x7b, - 0x50, 0x56, 0x3a, 0x66, 0x9c, 0xc7, 0x92, 0x29, 0xc6, 0x75, 0x24, 0x15, 0x1a, 0xf4, 0xba, 0xf5, - 0x3a, 0x62, 0x9c, 0x0f, 0xce, 0x72, 0xcc, 0xd1, 0x2e, 0xe3, 0xfa, 0xd5, 0xf0, 0xc1, 0x45, 0x86, - 0x9a, 0xa3, 0xa6, 0x0d, 0x68, 0x86, 0x06, 0x5d, 0xfe, 0x10, 0xb7, 0x33, 0xb3, 0x2e, 0xef, 0xd1, - 0x3d, 0x95, 0x88, 0x25, 0xcd, 0x14, 0x30, 0x53, 0xa0, 0xa0, 0xcf, 0x00, 0x7d, 0x12, 0x90, 0xf0, - 0x38, 0xb9, 0xde, 0xec, 0x86, 0xce, 0xd7, 0x6e, 0xd8, 0x6b, 0xfe, 0xea, 0xc5, 0x2a, 0x2a, 0x30, - 0xe6, 0xcc, 0x2c, 0xa3, 0x89, 0x30, 0x1f, 0xef, 0x23, 0xb7, 0x95, 0x4e, 0x84, 0x99, 0x9f, 0xd4, - 0x96, 0x71, 0x2b, 0xb9, 0x07, 0xf0, 0x6e, 0xdd, 0x73, 0x5d, 0x16, 0x52, 0xb2, 0x1c, 0xa8, 0x51, - 0x2c, 0x5b, 0xd1, 0xc5, 0x5a, 0x59, 0xda, 0xff, 0x17, 0x90, 0xf0, 0x68, 0xde, 0xfb, 0xc3, 0x0f, - 0x35, 0xbd, 0x6b, 0xa1, 0x37, 0x75, 0xaf, 0x40, 0xb0, 0xb4, 0x04, 0x9a, 0x32, 0x0d, 0x34, 0x5b, - 0x2b, 0x05, 0x22, 0xab, 0xa8, 0x64, 0x85, 0x82, 0x05, 0xb5, 0xc7, 0xa2, 0x28, 0xab, 0xfe, 0xff, - 0x80, 0x84, 0xdd, 0x79, 0xd0, 0x84, 0x13, 0xa6, 0x61, 0xdc, 0x46, 0x67, 0x36, 0x39, 0x43, 0x2c, - 0xa7, 0xa2, 0xac, 0x92, 0x64, 0xb3, 0xf7, 0xc9, 0x76, 0xef, 0x93, 0xef, 0xbd, 0x4f, 0xde, 0x0e, - 0xbe, 0xb3, 0x3d, 0xf8, 0xce, 0xe7, 0xc1, 0x77, 0x9e, 0xc2, 0xbc, 0x30, 0xcb, 0x75, 0x1a, 0x65, - 0xc8, 0xe3, 0xba, 0xcc, 0x91, 0x00, 0xf3, 0x82, 0x6a, 0x65, 0x87, 0xf8, 0xd5, 0x56, 0x6e, 0x2a, - 0x09, 0x3a, 0xed, 0xd8, 0xde, 0x6e, 0x7e, 0x03, 0x00, 0x00, 0xff, 0xff, 0x94, 0xe4, 0x5e, 0x90, - 0x8b, 0x01, 0x00, 0x00, + // 538 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0x41, 0x6b, 0x13, 0x41, + 0x14, 0xc7, 0xb3, 0xb6, 0xc6, 0x66, 0x14, 0xc4, 0xd5, 0xe0, 0xb6, 0x91, 0x4d, 0x28, 0x08, 0x01, + 0x69, 0x16, 0x15, 0xbc, 0x9b, 0xc6, 0x42, 0x41, 0x69, 0x58, 0x84, 0x82, 0x97, 0x61, 0xb2, 0x79, + 0xd9, 0x2c, 0x99, 0x9d, 0x37, 0xce, 0x4c, 0x9a, 0xee, 0xb7, 0xf0, 0xab, 0x08, 0x7e, 0x88, 0x1e, + 0x8b, 0x27, 0xf1, 0x50, 0x24, 0xf9, 0x02, 0x7e, 0x04, 0xd9, 0xd9, 0x4d, 0x88, 0xa4, 0xa7, 0x78, + 0xf1, 0xb6, 0xf3, 0xfe, 0x8f, 0xdf, 0xff, 0xbd, 0x9d, 0x37, 0x8f, 0xd4, 0x81, 0x67, 0x3a, 0x60, + 0x69, 0x1a, 0x48, 0xa6, 0x58, 0xaa, 0x3b, 0x52, 0xa1, 0x41, 0x77, 0x2f, 0x0f, 0x77, 0x58, 0x9a, + 0x1e, 0x3c, 0x89, 0x31, 0x46, 0x1b, 0x0c, 0xf2, 0xaf, 0x42, 0x3f, 0xd8, 0x8f, 0x50, 0xa7, 0xa8, + 0x69, 0x21, 0x14, 0x87, 0x42, 0x3a, 0xfc, 0xed, 0x90, 0x07, 0xef, 0x21, 0x66, 0x51, 0xd6, 0xb7, + 0x44, 0xf7, 0x9c, 0x3c, 0x92, 0x88, 0x9c, 0x46, 0x0a, 0x98, 0x49, 0x50, 0xd0, 0x11, 0x80, 0xe7, + 0xb4, 0x9c, 0x76, 0xad, 0xfb, 0xe2, 0xea, 0xa6, 0x59, 0xf9, 0x79, 0xd3, 0xac, 0x17, 0x04, 0x3d, + 0x9c, 0x74, 0x12, 0x0c, 0x52, 0x66, 0xc6, 0x9d, 0x53, 0x61, 0xbe, 0x7f, 0x3b, 0x22, 0x25, 0xfa, + 0x54, 0x98, 0xf0, 0x61, 0x4e, 0x39, 0x2e, 0x21, 0x27, 0x00, 0xee, 0x1b, 0xf2, 0x54, 0xf3, 0x44, + 0x4a, 0x16, 0x03, 0x35, 0x8a, 0x45, 0x13, 0x3a, 0x9c, 0x2a, 0xab, 0x7a, 0x77, 0x5a, 0x4e, 0x7b, + 0x37, 0xac, 0x2f, 0xe5, 0x8f, 0xb9, 0xda, 0x2b, 0x45, 0xf7, 0x8c, 0x3c, 0x07, 0xc1, 0x06, 0x1c, + 0xe8, 0x80, 0x69, 0xa0, 0xd1, 0x54, 0x29, 0x10, 0x51, 0x46, 0x25, 0x4b, 0x14, 0x0c, 0xa9, 0x2d, + 0x16, 0x05, 0xcf, 0xbc, 0x9d, 0x96, 0xd3, 0xde, 0x0b, 0x5b, 0x45, 0x72, 0x97, 0x69, 0x38, 0x2e, + 0x53, 0xfb, 0x36, 0xb3, 0x8f, 0xc8, 0xcf, 0x04, 0xcf, 0x0e, 0xbf, 0x56, 0x49, 0xf5, 0x7f, 0x6d, + 0xb6, 0x49, 0xee, 0xdb, 0x2e, 0x99, 0xd6, 0x60, 0xb4, 0xb7, 0xd3, 0xda, 0x69, 0xd7, 0x42, 0x92, + 0x87, 0xde, 0xda, 0x88, 0xab, 0xc8, 0xb3, 0x19, 0x24, 0xf1, 0xd8, 0xd0, 0x81, 0x02, 0x36, 0x49, + 0x44, 0x9c, 0xd7, 0x4c, 0xe1, 0x52, 0xa2, 0x00, 0x61, 0xbc, 0x5d, 0x5b, 0xfc, 0xcb, 0xb2, 0xf8, + 0xc6, 0x66, 0xf1, 0xc5, 0x65, 0xf7, 0x20, 0x5a, 0x6b, 0xa1, 0x07, 0x51, 0xb8, 0x5f, 0x60, 0xbb, + 0x25, 0xf5, 0x04, 0xe0, 0x5d, 0xc9, 0x74, 0x2f, 0x88, 0x7f, 0x9b, 0x67, 0x3a, 0xe5, 0x26, 0x91, + 0x3c, 0x01, 0xe5, 0xdd, 0xdd, 0xd6, 0xb5, 0xb1, 0xe1, 0xfa, 0x61, 0x45, 0x75, 0x25, 0x69, 0xdc, + 0xe6, 0x2b, 0x51, 0xd9, 0x1f, 0x59, 0xdd, 0xd6, 0xd4, 0xdb, 0x30, 0xed, 0x17, 0xc8, 0x35, 0x47, + 0x05, 0x11, 0x5e, 0x80, 0xca, 0xfe, 0x72, 0xbc, 0xf7, 0x8f, 0x8e, 0x61, 0x09, 0x5d, 0x73, 0xfc, + 0x4c, 0x1a, 0x66, 0xac, 0x40, 0x8f, 0x91, 0x0f, 0x69, 0xe9, 0x3d, 0x4c, 0x46, 0x23, 0xc8, 0x27, + 0x17, 0xbc, 0xbd, 0xad, 0xaf, 0x73, 0x45, 0x3d, 0xb7, 0xd0, 0xde, 0x8a, 0xe9, 0xbe, 0x22, 0x75, + 0xc6, 0x39, 0xce, 0x96, 0x8f, 0xc7, 0x0e, 0x3f, 0x2a, 0xed, 0xd5, 0xec, 0xb4, 0x3d, 0x2e, 0xc5, + 0xfe, 0x72, 0xa4, 0x51, 0xe9, 0x6e, 0xf7, 0x6a, 0xee, 0x3b, 0xd7, 0x73, 0xdf, 0xf9, 0x35, 0xf7, + 0x9d, 0x2f, 0x0b, 0xbf, 0x72, 0xbd, 0xf0, 0x2b, 0x3f, 0x16, 0x7e, 0xe5, 0x53, 0x3b, 0x4e, 0xcc, + 0x78, 0x3a, 0xe8, 0x44, 0x98, 0x06, 0xf9, 0x1a, 0x3a, 0x12, 0x60, 0x66, 0xa8, 0x26, 0xf6, 0x10, + 0x5c, 0xda, 0x65, 0x65, 0x32, 0x09, 0x7a, 0x50, 0xb5, 0x1b, 0xe7, 0xf5, 0x9f, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xe4, 0xff, 0xe6, 0xa0, 0xc5, 0x04, 0x00, 0x00, } -func (m *Params) Marshal() (dAtA []byte, err error) { +func (m *LegacyParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -120,12 +200,12 @@ func (m *Params) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *Params) MarshalTo(dAtA []byte) (int, error) { +func (m *LegacyParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *LegacyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -158,6 +238,112 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +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.AllowedPoolCreators) > 0 { + for iNdEx := len(m.AllowedPoolCreators) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.AllowedPoolCreators[iNdEx]) + copy(dAtA[i:], m.AllowedPoolCreators[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.AllowedPoolCreators[iNdEx]))) + i-- + dAtA[i] = 0x4a + } + } + { + size := m.ThresholdWeightDifference.Size() + i -= size + if _, err := m.ThresholdWeightDifference.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + { + size := m.WeightRecoveryFeePortion.Size() + i -= size + if _, err := m.WeightRecoveryFeePortion.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + { + size := m.WeightBreakingFeePortion.Size() + i -= size + if _, err := m.WeightBreakingFeePortion.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + { + size := m.WeightBreakingFeeMultiplier.Size() + i -= size + if _, err := m.WeightBreakingFeeMultiplier.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + { + size := m.WeightBreakingFeeExponent.Size() + i -= size + if _, err := m.WeightBreakingFeeExponent.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x22 + if len(m.BaseAssets) > 0 { + for iNdEx := len(m.BaseAssets) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.BaseAssets[iNdEx]) + copy(dAtA[i:], m.BaseAssets[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.BaseAssets[iNdEx]))) + i-- + dAtA[i] = 0x1a + } + } + if m.SlippageTrackDuration != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SlippageTrackDuration)) + i-- + dAtA[i] = 0x10 + } + { + size := m.PoolCreationFee.Size() + i -= size + if _, err := m.PoolCreationFee.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintParams(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintParams(dAtA []byte, offset int, v uint64) int { offset -= sovParams(v) base := offset @@ -169,7 +355,7 @@ func encodeVarintParams(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *Params) Size() (n int) { +func (m *LegacyParams) Size() (n int) { if m == nil { return 0 } @@ -186,13 +372,49 @@ func (m *Params) Size() (n int) { return n } +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.PoolCreationFee.Size() + n += 1 + l + sovParams(uint64(l)) + if m.SlippageTrackDuration != 0 { + n += 1 + sovParams(uint64(m.SlippageTrackDuration)) + } + if len(m.BaseAssets) > 0 { + for _, s := range m.BaseAssets { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + l = m.WeightBreakingFeeExponent.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.WeightBreakingFeeMultiplier.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.WeightBreakingFeePortion.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.WeightRecoveryFeePortion.Size() + n += 1 + l + sovParams(uint64(l)) + l = m.ThresholdWeightDifference.Size() + n += 1 + l + sovParams(uint64(l)) + if len(m.AllowedPoolCreators) > 0 { + for _, s := range m.AllowedPoolCreators { + l = len(s) + 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 { +func (m *LegacyParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -215,10 +437,10 @@ func (m *Params) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") + return fmt.Errorf("proto: LegacyParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LegacyParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -315,6 +537,343 @@ func (m *Params) Unmarshal(dAtA []byte) error { } return nil } +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 PoolCreationFee", 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 + } + if err := m.PoolCreationFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SlippageTrackDuration", wireType) + } + m.SlippageTrackDuration = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SlippageTrackDuration |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field BaseAssets", 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.BaseAssets = append(m.BaseAssets, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeExponent", 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 + } + if err := m.WeightBreakingFeeExponent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeMultiplier", 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 + } + if err := m.WeightBreakingFeeMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeePortion", 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 + } + if err := m.WeightBreakingFeePortion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field WeightRecoveryFeePortion", 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 + } + if err := m.WeightRecoveryFeePortion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ThresholdWeightDifference", 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 + } + if err := m.ThresholdWeightDifference.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field AllowedPoolCreators", 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.AllowedPoolCreators = append(m.AllowedPoolCreators, 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 diff --git a/x/amm/types/params_test.go b/x/amm/types/params_test.go index e9c007163..04e7f851c 100644 --- a/x/amm/types/params_test.go +++ b/x/amm/types/params_test.go @@ -8,7 +8,7 @@ import ( ) func TestDefaultParams(t *testing.T) { - require.Equal(t, types.DefaultParams(), types.NewParams(math.NewInt(10_000_000), 86400*7, false)) + require.Equal(t, types.DefaultParams(), types.NewParams(math.NewInt(10_000_000), 86400*7, []string{})) } func TestParamsValidation(t *testing.T) { diff --git a/x/amm/types/pool.go b/x/amm/types/pool.go index 8e21026f5..c3da105d3 100644 --- a/x/amm/types/pool.go +++ b/x/amm/types/pool.go @@ -306,8 +306,9 @@ func (p *Pool) CalcExitPoolCoinsFromShares( accountedPoolKeeper AccountedPoolKeeper, exitingShares sdkmath.Int, tokenOutDenom string, + params Params, ) (exitedCoins sdk.Coins, weightBalanceBonus sdkmath.LegacyDec, err error) { - return CalcExitPool(ctx, oracleKeeper, *p, accountedPoolKeeper, exitingShares, tokenOutDenom) + return CalcExitPool(ctx, oracleKeeper, *p, accountedPoolKeeper, exitingShares, tokenOutDenom, params) } func (p *Pool) TVL(ctx sdk.Context, oracleKeeper OracleKeeper, accountedPoolKeeper AccountedPoolKeeper) (sdkmath.LegacyDec, error) { diff --git a/x/amm/types/pool.pb.go b/x/amm/types/pool.pb.go index 543c62b69..ebd408d22 100644 --- a/x/amm/types/pool.pb.go +++ b/x/amm/types/pool.pb.go @@ -32,7 +32,7 @@ type LegacyPool struct { Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` PoolParams LegacyPoolParams `protobuf:"bytes,3,opt,name=pool_params,json=poolParams,proto3" json:"pool_params"` TotalShares types.Coin `protobuf:"bytes,4,opt,name=total_shares,json=totalShares,proto3" json:"total_shares"` - PoolAssets []LegacyPoolAsset `protobuf:"bytes,5,rep,name=pool_assets,json=poolAssets,proto3" json:"pool_assets"` + PoolAssets []PoolAsset `protobuf:"bytes,5,rep,name=pool_assets,json=poolAssets,proto3" json:"pool_assets"` TotalWeight cosmossdk_io_math.Int `protobuf:"bytes,6,opt,name=total_weight,json=totalWeight,proto3,customtype=cosmossdk.io/math.Int" json:"total_weight"` RebalanceTreasury string `protobuf:"bytes,7,opt,name=rebalance_treasury,json=rebalanceTreasury,proto3" json:"rebalance_treasury,omitempty"` } @@ -98,7 +98,7 @@ func (m *LegacyPool) GetTotalShares() types.Coin { return types.Coin{} } -func (m *LegacyPool) GetPoolAssets() []LegacyPoolAsset { +func (m *LegacyPool) GetPoolAssets() []PoolAsset { if m != nil { return m.PoolAssets } @@ -305,45 +305,44 @@ func init() { func init() { proto.RegisterFile("elys/amm/pool.proto", fileDescriptor_3ac3be9a215271f9) } var fileDescriptor_3ac3be9a215271f9 = []byte{ - // 594 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x94, 0x4d, 0x6b, 0x13, 0x41, - 0x18, 0xc7, 0xb3, 0x4d, 0x4c, 0xcc, 0xa4, 0x0a, 0x4e, 0x2b, 0xdd, 0x46, 0xd9, 0x84, 0x9c, 0x02, - 0x92, 0x5d, 0xa3, 0x37, 0xbd, 0xd8, 0x6d, 0x3d, 0x04, 0x44, 0xc3, 0x36, 0x50, 0xf0, 0xb2, 0x4c, - 0x76, 0xc7, 0xcd, 0x92, 0xdd, 0x9d, 0x61, 0x66, 0xfa, 0x92, 0x4f, 0xe0, 0xd5, 0xcf, 0x21, 0x78, - 0x13, 0xfc, 0x0a, 0x3d, 0x16, 0x4f, 0xe2, 0xa1, 0x4a, 0xf2, 0x19, 0xbc, 0xcb, 0xcc, 0x4e, 0x9a, - 0x04, 0xd3, 0x4b, 0x41, 0xe8, 0x29, 0xf3, 0xbc, 0xfd, 0xf3, 0x7b, 0x9e, 0x67, 0x76, 0xc0, 0x16, - 0x4e, 0x26, 0xdc, 0x41, 0x69, 0xea, 0x50, 0x42, 0x12, 0x9b, 0x32, 0x22, 0x08, 0xbc, 0x2b, 0x9d, - 0x36, 0x4a, 0xd3, 0x7a, 0x7d, 0x25, 0xec, 0x53, 0xc4, 0x50, 0xca, 0xf3, 0xac, 0xfa, 0xee, 0x6a, - 0x0c, 0x71, 0x8e, 0x85, 0x0e, 0x6d, 0x47, 0x24, 0x22, 0xea, 0xe8, 0xc8, 0x93, 0xf6, 0x5a, 0x01, - 0xe1, 0x29, 0xe1, 0xce, 0x10, 0x71, 0xec, 0x9c, 0x74, 0x87, 0x58, 0xa0, 0xae, 0x13, 0x90, 0x38, - 0x9b, 0x0b, 0xe6, 0x71, 0x3f, 0x2f, 0xcc, 0x8d, 0x3c, 0xd4, 0xfa, 0x58, 0x04, 0xe0, 0x0d, 0x8e, - 0x50, 0x30, 0xe9, 0x13, 0x92, 0xc0, 0x1d, 0x50, 0x51, 0xff, 0x19, 0x87, 0xa6, 0xd1, 0x34, 0xda, - 0x25, 0xaf, 0x2c, 0xcd, 0x5e, 0x08, 0x4d, 0x50, 0x41, 0x61, 0xc8, 0x30, 0xe7, 0xe6, 0x46, 0xd3, - 0x68, 0x57, 0xbd, 0xb9, 0x09, 0xf7, 0x40, 0x6d, 0xa9, 0x05, 0xb3, 0xd8, 0x34, 0xda, 0xb5, 0x67, - 0x75, 0x7b, 0xde, 0xa9, 0xbd, 0x50, 0xef, 0xab, 0x0c, 0xb7, 0x74, 0x7e, 0xd9, 0x28, 0x78, 0x80, - 0x5e, 0x79, 0xa0, 0x0b, 0x36, 0x05, 0x11, 0x28, 0xf1, 0xf9, 0x08, 0x31, 0xcc, 0xcd, 0x92, 0xd2, - 0xd8, 0xb5, 0x35, 0xa9, 0x6c, 0xcb, 0xd6, 0x6d, 0xd9, 0xfb, 0x24, 0xce, 0xb4, 0x44, 0x4d, 0x15, - 0x1d, 0xaa, 0x1a, 0xf8, 0x4a, 0x63, 0xa8, 0x69, 0x71, 0xf3, 0x4e, 0xb3, 0xa8, 0x24, 0xd6, 0x60, - 0xec, 0xc9, 0x8c, 0x65, 0x0a, 0xe5, 0xe0, 0xf0, 0xed, 0x9c, 0xe2, 0x14, 0xc7, 0xd1, 0x48, 0x98, - 0x65, 0xd9, 0xa7, 0xfb, 0x44, 0xe6, 0xfd, 0xbc, 0x6c, 0x3c, 0xcc, 0x61, 0x78, 0x38, 0xb6, 0x63, - 0xe2, 0xa4, 0x48, 0x8c, 0xec, 0x5e, 0x26, 0xbe, 0x7f, 0xed, 0x00, 0x4d, 0xd9, 0xcb, 0x84, 0x26, - 0x3a, 0x52, 0xf5, 0xb0, 0x03, 0x20, 0xc3, 0x43, 0x94, 0xa0, 0x2c, 0xc0, 0xbe, 0x60, 0x18, 0xf1, - 0x63, 0x36, 0x31, 0x2b, 0x6a, 0x7a, 0x0f, 0xae, 0x22, 0x03, 0x1d, 0x68, 0xfd, 0xd9, 0x00, 0xa5, - 0x9b, 0xee, 0xe0, 0xe5, 0xba, 0x1d, 0x6c, 0x2f, 0x9a, 0xff, 0xef, 0xd3, 0x7f, 0xb1, 0x6e, 0xfa, - 0x5b, 0xab, 0x00, 0xb7, 0x74, 0xee, 0x5f, 0x0c, 0x70, 0x4f, 0xe2, 0xbd, 0x3e, 0x13, 0x0c, 0xf5, - 0xb2, 0x0f, 0x04, 0xee, 0x83, 0xa2, 0x38, 0x49, 0xd4, 0xf0, 0xab, 0x6e, 0x57, 0x73, 0x3c, 0xfa, - 0x97, 0x23, 0xbf, 0x52, 0x07, 0x38, 0x58, 0xa2, 0x39, 0xc0, 0x81, 0x27, 0xab, 0xe1, 0x11, 0xb8, - 0x9f, 0x50, 0x5f, 0x90, 0x31, 0xce, 0x7c, 0xca, 0xe2, 0x00, 0xe7, 0x3b, 0xbb, 0x89, 0xde, 0x66, - 0x42, 0x07, 0x52, 0xa7, 0x2f, 0x65, 0x5a, 0xdf, 0x0c, 0xb0, 0xf3, 0x8e, 0xa1, 0x20, 0xc1, 0x92, - 0xfa, 0x30, 0x89, 0x29, 0x45, 0x11, 0x1e, 0x30, 0x14, 0x8c, 0xaf, 0xbf, 0x3a, 0x8f, 0x41, 0x55, - 0xc4, 0x29, 0xe6, 0x02, 0xa5, 0x54, 0x81, 0x94, 0xbc, 0x85, 0x03, 0x62, 0x50, 0x11, 0xb2, 0x1e, - 0x87, 0x66, 0x51, 0x7f, 0x37, 0xd7, 0x2e, 0xff, 0xa9, 0xe4, 0xff, 0xfc, 0xab, 0xd1, 0x8e, 0x62, - 0x31, 0x3a, 0x1e, 0xda, 0x01, 0x49, 0xf5, 0x8b, 0xa2, 0x7f, 0x3a, 0x3c, 0x1c, 0x3b, 0x62, 0x42, - 0x31, 0x57, 0x05, 0xdc, 0x9b, 0x6b, 0xbb, 0xee, 0xf9, 0xd4, 0x32, 0x2e, 0xa6, 0x96, 0xf1, 0x7b, - 0x6a, 0x19, 0x9f, 0x66, 0x56, 0xe1, 0x62, 0x66, 0x15, 0x7e, 0xcc, 0xac, 0xc2, 0xfb, 0x65, 0x31, - 0x79, 0x67, 0x3a, 0x19, 0x16, 0xa7, 0x84, 0x8d, 0x95, 0xe1, 0x9c, 0xa9, 0xb7, 0x50, 0x49, 0x0e, - 0xcb, 0xea, 0xd9, 0x7a, 0xfe, 0x37, 0x00, 0x00, 0xff, 0xff, 0x14, 0xba, 0x73, 0xc1, 0x5f, 0x05, - 0x00, 0x00, + // 590 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x94, 0xcf, 0x6e, 0xd3, 0x40, + 0x10, 0xc6, 0xe3, 0x26, 0x34, 0x74, 0x53, 0x90, 0xd8, 0x16, 0xd5, 0x0d, 0xc8, 0x89, 0x72, 0x8a, + 0x84, 0x62, 0x93, 0x72, 0x83, 0x53, 0xdd, 0x72, 0x88, 0x84, 0x20, 0x72, 0x23, 0x55, 0xe2, 0x62, + 0x6d, 0xec, 0xc1, 0xb1, 0x62, 0x7b, 0xad, 0xdd, 0xed, 0x9f, 0x1c, 0x79, 0x03, 0x9e, 0x03, 0x89, + 0x1b, 0x12, 0xaf, 0xd0, 0x63, 0xc5, 0x09, 0x71, 0x28, 0x28, 0x79, 0x06, 0xee, 0x68, 0xd7, 0x9b, + 0x26, 0x11, 0x85, 0x43, 0xcf, 0x9c, 0xec, 0x99, 0x6f, 0xe7, 0xdb, 0xdf, 0xcc, 0xae, 0x16, 0x6d, + 0x41, 0x32, 0xe1, 0x0e, 0x49, 0x53, 0x27, 0xa7, 0x34, 0xb1, 0x73, 0x46, 0x05, 0xc5, 0x77, 0x65, + 0xd2, 0x26, 0x69, 0x5a, 0xaf, 0xaf, 0xc8, 0x7e, 0x4e, 0x18, 0x49, 0x79, 0xb1, 0xaa, 0xbe, 0xbb, + 0xaa, 0x11, 0xce, 0x41, 0x68, 0x69, 0x3b, 0xa2, 0x11, 0x55, 0xbf, 0x8e, 0xfc, 0xd3, 0x59, 0x2b, + 0xa0, 0x3c, 0xa5, 0xdc, 0x19, 0x12, 0x0e, 0xce, 0x69, 0x77, 0x08, 0x82, 0x74, 0x9d, 0x80, 0xc6, + 0xd9, 0xdc, 0xb0, 0xd0, 0xfd, 0xa2, 0xb0, 0x08, 0x0a, 0xa9, 0xf5, 0xbe, 0x8c, 0xd0, 0x2b, 0x88, + 0x48, 0x30, 0xe9, 0x53, 0x9a, 0xe0, 0x1d, 0x54, 0x55, 0x7b, 0xc6, 0xa1, 0x69, 0x34, 0x8d, 0x76, + 0xc5, 0x5b, 0x97, 0x61, 0x2f, 0xc4, 0x26, 0xaa, 0x92, 0x30, 0x64, 0xc0, 0xb9, 0xb9, 0xd6, 0x34, + 0xda, 0x1b, 0xde, 0x3c, 0xc4, 0xfb, 0xa8, 0xb6, 0xd4, 0x82, 0x59, 0x6e, 0x1a, 0xed, 0xda, 0x5e, + 0xdd, 0x9e, 0x77, 0x6a, 0x2f, 0xdc, 0xfb, 0x6a, 0x85, 0x5b, 0xb9, 0xb8, 0x6a, 0x94, 0x3c, 0x94, + 0x5f, 0x67, 0xb0, 0x8b, 0x36, 0x05, 0x15, 0x24, 0xf1, 0xf9, 0x88, 0x30, 0xe0, 0x66, 0x45, 0x79, + 0xec, 0xda, 0x9a, 0x54, 0xb6, 0x65, 0xeb, 0xb6, 0xec, 0x03, 0x1a, 0x67, 0xda, 0xa2, 0xa6, 0x8a, + 0x8e, 0x54, 0x0d, 0x7e, 0xae, 0x31, 0xd4, 0xb4, 0xb8, 0x79, 0xa7, 0x59, 0x6e, 0xd7, 0xf6, 0xb6, + 0x16, 0x18, 0x12, 0x60, 0x5f, 0x6a, 0xcb, 0xfb, 0xab, 0x04, 0xc7, 0xaf, 0xe7, 0xfb, 0x9f, 0x41, + 0x1c, 0x8d, 0x84, 0xb9, 0x2e, 0x3b, 0x74, 0x9f, 0xc8, 0x75, 0xdf, 0xaf, 0x1a, 0x0f, 0x0b, 0x0c, + 0x1e, 0x8e, 0xed, 0x98, 0x3a, 0x29, 0x11, 0x23, 0xbb, 0x97, 0x89, 0xaf, 0x9f, 0x3b, 0x48, 0xf3, + 0xf5, 0x32, 0xa1, 0x59, 0x8e, 0x55, 0x3d, 0xee, 0x20, 0xcc, 0x60, 0x48, 0x12, 0x92, 0x05, 0xe0, + 0x0b, 0x06, 0x84, 0x9f, 0xb0, 0x89, 0x59, 0x55, 0x73, 0x7b, 0x70, 0xad, 0x0c, 0xb4, 0xd0, 0xfa, + 0xb5, 0x86, 0x2a, 0xb7, 0x9d, 0xfe, 0x8b, 0x9b, 0xa6, 0xbf, 0xbd, 0xda, 0xf6, 0xff, 0xb9, 0xdf, + 0x3c, 0xf7, 0x4f, 0x06, 0xba, 0x27, 0xf1, 0x5e, 0x9e, 0x0b, 0x46, 0x7a, 0xd9, 0x3b, 0x8a, 0x0f, + 0x50, 0x59, 0x9c, 0x26, 0x6a, 0xf8, 0x1b, 0x6e, 0x57, 0x73, 0x3c, 0xfa, 0x93, 0xa3, 0xb8, 0xd3, + 0x87, 0x10, 0x2c, 0xd1, 0x1c, 0x42, 0xe0, 0xc9, 0x6a, 0x7c, 0x8c, 0xee, 0x27, 0xb9, 0x2f, 0xe8, + 0x18, 0x32, 0x3f, 0x67, 0x71, 0x00, 0xc5, 0x99, 0xdd, 0xc6, 0x6f, 0x33, 0xc9, 0x07, 0xd2, 0xa7, + 0x2f, 0x6d, 0x5a, 0x5f, 0x0c, 0xb4, 0xf3, 0x86, 0x91, 0x20, 0x01, 0x49, 0x7d, 0x94, 0xc4, 0x79, + 0x4e, 0x22, 0x18, 0x30, 0x12, 0x8c, 0xff, 0x7e, 0x75, 0x1e, 0xa3, 0x0d, 0x11, 0xa7, 0xc0, 0x05, + 0x49, 0x73, 0x05, 0x52, 0xf1, 0x16, 0x09, 0x0c, 0xa8, 0x2a, 0x64, 0x3d, 0x84, 0x66, 0x59, 0x9d, + 0xdc, 0x3f, 0x0e, 0xff, 0xa9, 0xe4, 0xff, 0xf8, 0xa3, 0xd1, 0x8e, 0x62, 0x31, 0x3a, 0x19, 0xda, + 0x01, 0x4d, 0xf5, 0x5b, 0xa2, 0x3f, 0x1d, 0x1e, 0x8e, 0x1d, 0x31, 0xc9, 0x81, 0xab, 0x02, 0xee, + 0xcd, 0xbd, 0x5d, 0xf7, 0x62, 0x6a, 0x19, 0x97, 0x53, 0xcb, 0xf8, 0x39, 0xb5, 0x8c, 0x0f, 0x33, + 0xab, 0x74, 0x39, 0xb3, 0x4a, 0xdf, 0x66, 0x56, 0xe9, 0xed, 0xb2, 0x99, 0xbc, 0x33, 0x9d, 0x0c, + 0xc4, 0x19, 0x65, 0x63, 0x15, 0x38, 0xe7, 0xea, 0x15, 0x54, 0x96, 0xc3, 0x75, 0xf5, 0x60, 0x3d, + 0xfb, 0x1d, 0x00, 0x00, 0xff, 0xff, 0x5f, 0x50, 0x77, 0xe0, 0x59, 0x05, 0x00, 0x00, } func (m *LegacyPool) Marshal() (dAtA []byte, err error) { @@ -898,7 +897,7 @@ func (m *LegacyPool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.PoolAssets = append(m.PoolAssets, LegacyPoolAsset{}) + m.PoolAssets = append(m.PoolAssets, PoolAsset{}) if err := m.PoolAssets[len(m.PoolAssets)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/amm/types/pool_asset.go b/x/amm/types/pool_asset.go new file mode 100644 index 000000000..194c02a9e --- /dev/null +++ b/x/amm/types/pool_asset.go @@ -0,0 +1,22 @@ +package types + +import ( + "cosmossdk.io/math" + "fmt" +) + +func (asset PoolAsset) Validate() error { + if !asset.Token.IsValid() { + return fmt.Errorf("invalid pool asset token") + } + + if asset.Weight.IsNil() || asset.Weight.IsNegative() { + return fmt.Errorf("invalid pool asset weight (%s)", asset.Token.Denom) + } + + if asset.ExternalLiquidityRatio.IsNil() || asset.ExternalLiquidityRatio.LT(math.LegacyOneDec()) { + return fmt.Errorf("invalid external liquidity ratio for asset %s", asset.Token.Denom) + } + + return nil +} diff --git a/x/amm/types/pool_asset_test.go b/x/amm/types/pool_asset_test.go new file mode 100644 index 000000000..c1addf7fa --- /dev/null +++ b/x/amm/types/pool_asset_test.go @@ -0,0 +1,86 @@ +package types_test + +import ( + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/amm/types" +) + +func (suite *TestSuite) TestPoolAssetValidate() { + suite.SetupTest() + poolAsset := types.PoolAsset{ + Token: sdk.Coin{}, + Weight: sdkmath.Int{}, + ExternalLiquidityRatio: sdkmath.LegacyDec{}, + } + for _, tc := range []struct { + name string + errorMsg string + function func() + }{ + { + name: "token is nil", + errorMsg: "invalid pool asset token", + function: func() {}, + }, + { + name: "invalid token denom", + errorMsg: "invalid pool asset token", + function: func() { + poolAsset.Token = sdk.Coin{"%%%", sdkmath.OneInt()} + }, + }, + { + name: "token is -ve", + errorMsg: "invalid pool asset token", + function: func() { + poolAsset.Token = sdk.Coin{"uatom", sdkmath.OneInt().MulRaw(-1)} + }, + }, + { + name: "weight is nil", + errorMsg: "invalid pool asset weight", + function: func() { + poolAsset.Token = sdk.Coin{"uatom", sdkmath.OneInt()} + }, + }, + { + name: "weight is -ve", + errorMsg: "invalid pool asset weight", + function: func() { + poolAsset.Weight = sdkmath.NewInt(-1) + }, + }, + { + name: "external liquidity ratio is nil", + errorMsg: "invalid external liquidity ratio", + function: func() { + poolAsset.Weight = sdkmath.OneInt() + }, + }, + { + name: "external liquidity ratio is < 1", + errorMsg: "invalid external liquidity ratio", + function: func() { + poolAsset.ExternalLiquidityRatio = sdkmath.LegacyNewDec(-1) + }, + }, + { + name: "success", + errorMsg: "", + function: func() { + poolAsset.ExternalLiquidityRatio = sdkmath.LegacyNewDec(1) + }, + }, + } { + suite.Run(tc.name, func() { + tc.function() + err := poolAsset.Validate() + if err != nil { + suite.Require().Contains(err.Error(), tc.errorMsg) + } else { + suite.Require().Equal(tc.errorMsg, "") + } + }) + } +} diff --git a/x/amm/types/pool_exit_pool.go b/x/amm/types/pool_exit_pool.go index 96234286c..6b1880293 100644 --- a/x/amm/types/pool_exit_pool.go +++ b/x/amm/types/pool_exit_pool.go @@ -5,8 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ) -func (p *Pool) ExitPool(ctx sdk.Context, oracleKeeper OracleKeeper, accountedPoolKeeper AccountedPoolKeeper, exitingShares math.Int, tokenOutDenom string) (exitingCoins sdk.Coins, err error) { - exitingCoins, _, err = p.CalcExitPoolCoinsFromShares(ctx, oracleKeeper, accountedPoolKeeper, exitingShares, tokenOutDenom) +func (p *Pool) ExitPool(ctx sdk.Context, oracleKeeper OracleKeeper, accountedPoolKeeper AccountedPoolKeeper, exitingShares math.Int, tokenOutDenom string, params Params) (exitingCoins sdk.Coins, err error) { + exitingCoins, _, err = p.CalcExitPoolCoinsFromShares(ctx, oracleKeeper, accountedPoolKeeper, exitingShares, tokenOutDenom, params) if err != nil { return sdk.Coins{}, err } diff --git a/x/amm/types/pool_join_pool.go b/x/amm/types/pool_join_pool.go index 5d24bf828..e726426b8 100644 --- a/x/amm/types/pool_join_pool.go +++ b/x/amm/types/pool_join_pool.go @@ -120,6 +120,7 @@ func (p *Pool) JoinPool( ctx sdk.Context, snapshot *Pool, oracleKeeper OracleKeeper, accountedPoolKeeper AccountedPoolKeeper, tokensIn sdk.Coins, + params Params, ) (numShares sdkmath.Int, slippage sdkmath.LegacyDec, weightBalanceBonus sdkmath.LegacyDec, err error) { // if it's not single sided liquidity, add at pool ratio if len(tokensIn) != 1 { @@ -195,14 +196,14 @@ func (p *Pool) JoinPool( // weight breaking fee as in Plasma pool weightIn := GetDenomOracleAssetWeight(ctx, p.PoolId, oracleKeeper, newAssetPools, tokenInDenom) weightOut := sdkmath.LegacyOneDec().Sub(weightIn) - weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, p.PoolParams, distanceDiff) + weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, distanceDiff, params) // weight recovery reward = weight breaking fee * weight recovery fee portion - weightRecoveryReward := weightBreakingFee.Mul(p.PoolParams.WeightRecoveryFeePortion) + weightRecoveryReward := weightBreakingFee.Mul(params.WeightRecoveryFeePortion) // bonus is valid when distance is lower than original distance and when threshold weight reached weightBalanceBonus = weightBreakingFee.Neg() - if initialWeightDistance.GT(p.PoolParams.ThresholdWeightDifference) && distanceDiff.IsNegative() { + if initialWeightDistance.GT(params.ThresholdWeightDifference) && distanceDiff.IsNegative() { weightBalanceBonus = weightRecoveryReward // set weight breaking fee to zero if bonus is applied weightBreakingFee = sdkmath.LegacyZeroDec() diff --git a/x/amm/types/pool_params.go b/x/amm/types/pool_params.go new file mode 100644 index 000000000..702b5be8e --- /dev/null +++ b/x/amm/types/pool_params.go @@ -0,0 +1,31 @@ +package types + +import ( + sdkmath "cosmossdk.io/math" + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +var ( + MaxSwapFee = sdkmath.LegacyMustNewDecFromStr("0.02") // 2% +) + +func (params PoolParams) Validate() error { + if params.SwapFee.IsNil() { + return fmt.Errorf("swap_fee is nil") + } + + if params.SwapFee.IsNegative() { + return ErrNegativeSwapFee + } + + if params.SwapFee.GT(MaxSwapFee) { + return ErrTooMuchSwapFee + } + + if err := sdk.ValidateDenom(params.FeeDenom); err != nil { + return err + } + + return nil +} diff --git a/x/amm/types/pool_params.pb.go b/x/amm/types/pool_params.pb.go index 14ff73663..041b1626f 100644 --- a/x/amm/types/pool_params.pb.go +++ b/x/amm/types/pool_params.pb.go @@ -31,11 +31,10 @@ type LegacyPoolParams struct { UseOracle bool `protobuf:"varint,3,opt,name=use_oracle,json=useOracle,proto3" json:"use_oracle,omitempty"` WeightBreakingFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=weight_breaking_fee_multiplier,json=weightBreakingFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_multiplier"` WeightBreakingFeeExponent cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=weight_breaking_fee_exponent,json=weightBreakingFeeExponent,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_exponent"` - ExternalLiquidityRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=external_liquidity_ratio,json=externalLiquidityRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"external_liquidity_ratio"` - WeightRecoveryFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_recovery_fee_portion"` - ThresholdWeightDifference cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"threshold_weight_difference"` - WeightBreakingFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,9,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_portion"` - FeeDenom string `protobuf:"bytes,10,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` + WeightRecoveryFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_recovery_fee_portion"` + ThresholdWeightDifference cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"threshold_weight_difference"` + WeightBreakingFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_portion"` + FeeDenom string `protobuf:"bytes,9,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` } func (m *LegacyPoolParams) Reset() { *m = LegacyPoolParams{} } @@ -86,15 +85,9 @@ func (m *LegacyPoolParams) GetFeeDenom() string { } type PoolParams struct { - SwapFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=swap_fee,json=swapFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"swap_fee"` - ExitFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=exit_fee,json=exitFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exit_fee"` - UseOracle bool `protobuf:"varint,3,opt,name=use_oracle,json=useOracle,proto3" json:"use_oracle,omitempty"` - WeightBreakingFeeMultiplier cosmossdk_io_math.LegacyDec `protobuf:"bytes,4,opt,name=weight_breaking_fee_multiplier,json=weightBreakingFeeMultiplier,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_multiplier"` - WeightBreakingFeeExponent cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=weight_breaking_fee_exponent,json=weightBreakingFeeExponent,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_exponent"` - WeightRecoveryFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,6,opt,name=weight_recovery_fee_portion,json=weightRecoveryFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_recovery_fee_portion"` - ThresholdWeightDifference cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=threshold_weight_difference,json=thresholdWeightDifference,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"threshold_weight_difference"` - WeightBreakingFeePortion cosmossdk_io_math.LegacyDec `protobuf:"bytes,8,opt,name=weight_breaking_fee_portion,json=weightBreakingFeePortion,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"weight_breaking_fee_portion"` - FeeDenom string `protobuf:"bytes,9,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` + SwapFee cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=swap_fee,json=swapFee,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"swap_fee"` + UseOracle bool `protobuf:"varint,2,opt,name=use_oracle,json=useOracle,proto3" json:"use_oracle,omitempty"` + FeeDenom string `protobuf:"bytes,3,opt,name=fee_denom,json=feeDenom,proto3" json:"fee_denom,omitempty"` } func (m *PoolParams) Reset() { *m = PoolParams{} } @@ -152,39 +145,36 @@ func init() { func init() { proto.RegisterFile("elys/amm/pool_params.proto", fileDescriptor_3500125990074bc9) } var fileDescriptor_3500125990074bc9 = []byte{ - // 505 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x95, 0x4f, 0x6a, 0xdb, 0x40, - 0x14, 0xc6, 0xad, 0xfe, 0xb1, 0xe5, 0x59, 0x15, 0x51, 0xca, 0x24, 0x6e, 0x95, 0x90, 0x95, 0x37, - 0xb1, 0x28, 0xbd, 0x81, 0x71, 0xbd, 0x72, 0xa9, 0xf1, 0xa6, 0xd0, 0xcd, 0x30, 0x96, 0x9f, 0xa5, - 0xc1, 0x1a, 0x3d, 0x65, 0x66, 0x14, 0x5b, 0xb7, 0xe8, 0xba, 0x17, 0xe8, 0x05, 0x7a, 0x88, 0x2c, - 0x43, 0x57, 0xa5, 0x8b, 0x50, 0xec, 0x8b, 0x94, 0x91, 0x64, 0x93, 0xd0, 0x42, 0x41, 0xa5, 0x81, - 0x42, 0x77, 0x7a, 0xf3, 0x98, 0xdf, 0xa7, 0x6f, 0x1e, 0x1f, 0x8f, 0x1c, 0x43, 0x52, 0xe8, 0x80, - 0x4b, 0x19, 0x64, 0x88, 0x09, 0xcb, 0xb8, 0xe2, 0x52, 0x0f, 0x32, 0x85, 0x06, 0x3d, 0xd7, 0xf6, - 0x06, 0x5c, 0xca, 0xe3, 0xa7, 0x11, 0x46, 0x58, 0x1e, 0x06, 0xf6, 0xab, 0xea, 0x1f, 0x1f, 0x85, - 0xa8, 0x25, 0x6a, 0x56, 0x35, 0xaa, 0xa2, 0x6a, 0x9d, 0x7d, 0xec, 0x90, 0x27, 0x13, 0x88, 0x78, - 0x58, 0x4c, 0x11, 0x93, 0x69, 0x49, 0xf5, 0x26, 0xc4, 0xd5, 0x6b, 0x9e, 0xb1, 0x25, 0x00, 0x75, - 0x4e, 0x9d, 0x7e, 0x77, 0xf8, 0xf2, 0xea, 0xe6, 0xa4, 0xf5, 0xed, 0xe6, 0xa4, 0x57, 0x5d, 0xd6, - 0x8b, 0xd5, 0x40, 0x60, 0x20, 0xb9, 0x89, 0x07, 0xd5, 0xed, 0x11, 0x84, 0x5f, 0x3e, 0x9f, 0x93, - 0x9a, 0x3d, 0x82, 0x70, 0xd6, 0xb1, 0x88, 0x31, 0x80, 0xa5, 0xc1, 0x46, 0x98, 0x92, 0xf6, 0xa0, - 0x31, 0xcd, 0x22, 0x2c, 0xed, 0x05, 0x21, 0xb9, 0x06, 0x86, 0x8a, 0x87, 0x09, 0xd0, 0x87, 0xa7, - 0x4e, 0xdf, 0x9d, 0x75, 0x73, 0x0d, 0x6f, 0xcb, 0x03, 0xef, 0x92, 0xf8, 0x6b, 0x10, 0x51, 0x6c, - 0xd8, 0x5c, 0x01, 0x5f, 0x89, 0x34, 0xb2, 0xba, 0x4c, 0xe6, 0x89, 0x11, 0x59, 0x22, 0x40, 0xd1, - 0x47, 0x4d, 0x7f, 0xa1, 0x57, 0x81, 0x87, 0x35, 0x77, 0x0c, 0xf0, 0xe6, 0x40, 0xf5, 0x14, 0x79, - 0xfe, 0x2b, 0x5d, 0xd8, 0x64, 0x98, 0x42, 0x6a, 0xe8, 0xe3, 0xa6, 0xaa, 0x47, 0x3f, 0xa9, 0xbe, - 0xae, 0x99, 0xde, 0x8a, 0x50, 0xd8, 0x18, 0x50, 0x29, 0x4f, 0x58, 0x22, 0x2e, 0x72, 0xb1, 0x10, - 0xa6, 0x60, 0x8a, 0x1b, 0x81, 0xb4, 0xdd, 0x54, 0xef, 0xd9, 0x1e, 0x39, 0xd9, 0x13, 0x67, 0x16, - 0xe8, 0x65, 0xa4, 0xf6, 0xcf, 0x14, 0x84, 0x78, 0x09, 0xaa, 0x28, 0x0d, 0x66, 0xa8, 0x8c, 0xc0, - 0x94, 0x76, 0x9a, 0xea, 0xd1, 0x8a, 0x3a, 0xab, 0xa1, 0x63, 0x80, 0x69, 0x85, 0xf4, 0x2e, 0x48, - 0xcf, 0xc4, 0x0a, 0x74, 0x8c, 0xc9, 0x82, 0xd5, 0xda, 0x0b, 0xb1, 0x5c, 0x82, 0x82, 0x34, 0x04, - 0xea, 0x36, 0x7e, 0xd1, 0x03, 0xf5, 0x5d, 0x09, 0x1d, 0x1d, 0x98, 0xb7, 0x4c, 0xde, 0x99, 0xe2, - 0xde, 0x64, 0xf7, 0x0f, 0x4d, 0xde, 0x1a, 0xe2, 0xde, 0x64, 0x8f, 0x74, 0xad, 0xc2, 0x02, 0x52, - 0x94, 0x94, 0x58, 0xfe, 0xcc, 0x5d, 0x02, 0x8c, 0x6c, 0x7d, 0xf6, 0xa9, 0x4d, 0xc8, 0xff, 0x58, - 0xfe, 0x6b, 0xb1, 0xfc, 0x4d, 0x52, 0xda, 0xf7, 0x9e, 0x94, 0xce, 0xfd, 0x27, 0xc5, 0xfd, 0xcb, - 0x49, 0xe9, 0xde, 0x4d, 0xca, 0x70, 0x78, 0xb5, 0xf5, 0x9d, 0xeb, 0xad, 0xef, 0x7c, 0xdf, 0xfa, - 0xce, 0x87, 0x9d, 0xdf, 0xba, 0xde, 0xf9, 0xad, 0xaf, 0x3b, 0xbf, 0xf5, 0xbe, 0x1f, 0x09, 0x13, - 0xe7, 0xf3, 0x41, 0x88, 0x32, 0xb0, 0x6b, 0xf2, 0x3c, 0x05, 0xb3, 0x46, 0xb5, 0x2a, 0x8b, 0x60, - 0x53, 0x6e, 0x54, 0x53, 0x64, 0xa0, 0xe7, 0xed, 0x72, 0x23, 0xbe, 0xfa, 0x11, 0x00, 0x00, 0xff, - 0xff, 0xd5, 0x30, 0x3f, 0xd3, 0x6a, 0x07, 0x00, 0x00, + // 461 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0xb1, 0x8e, 0xd3, 0x40, + 0x10, 0x86, 0xe3, 0x3b, 0xc8, 0x39, 0x5b, 0x21, 0x8b, 0xc2, 0x97, 0x80, 0xef, 0x74, 0x55, 0x9a, + 0xb3, 0x85, 0x78, 0x83, 0x28, 0xa4, 0x3a, 0x44, 0x94, 0x06, 0x89, 0xc6, 0xda, 0x38, 0x13, 0x7b, + 0x15, 0xaf, 0x67, 0xd9, 0xdd, 0x5c, 0x92, 0xb7, 0xa0, 0xe2, 0x2d, 0xe8, 0x78, 0x88, 0x2b, 0x4f, + 0x54, 0x88, 0xe2, 0x84, 0x92, 0x17, 0x41, 0xbb, 0xeb, 0x8b, 0x12, 0xa0, 0x32, 0xa2, 0xf3, 0xec, + 0x68, 0xbf, 0xff, 0xff, 0x57, 0xe3, 0x21, 0x5d, 0x28, 0x37, 0x2a, 0xa1, 0x9c, 0x27, 0x02, 0xb1, + 0x4c, 0x05, 0x95, 0x94, 0xab, 0x58, 0x48, 0xd4, 0x18, 0xf8, 0xa6, 0x17, 0x53, 0xce, 0xbb, 0xcf, + 0x73, 0xcc, 0xd1, 0x1e, 0x26, 0xe6, 0xcb, 0xf5, 0xbb, 0xe7, 0x19, 0x2a, 0x8e, 0x2a, 0x75, 0x0d, + 0x57, 0xb8, 0xd6, 0xd5, 0x97, 0x36, 0x79, 0x76, 0x03, 0x39, 0xcd, 0x36, 0x63, 0xc4, 0x72, 0x6c, + 0xa9, 0xc1, 0x0d, 0xf1, 0xd5, 0x8a, 0x8a, 0x74, 0x0e, 0x10, 0x7a, 0x97, 0x5e, 0xbf, 0x33, 0x78, + 0x75, 0xf7, 0x70, 0xd1, 0xfa, 0xf1, 0x70, 0xd1, 0x73, 0x97, 0xd5, 0x6c, 0x11, 0x33, 0x4c, 0x38, + 0xd5, 0x45, 0xec, 0x6e, 0x0f, 0x21, 0xfb, 0xf6, 0xf5, 0x9a, 0xd4, 0xec, 0x21, 0x64, 0x93, 0x33, + 0x83, 0x18, 0x01, 0x18, 0x1a, 0xac, 0x99, 0xb6, 0xb4, 0x93, 0xc6, 0x34, 0x83, 0x30, 0xb4, 0x97, + 0x84, 0x2c, 0x15, 0xa4, 0x28, 0x69, 0x56, 0x42, 0x78, 0x7a, 0xe9, 0xf5, 0xfd, 0x49, 0x67, 0xa9, + 0xe0, 0x9d, 0x3d, 0x08, 0x6e, 0x49, 0xb4, 0x02, 0x96, 0x17, 0x3a, 0x9d, 0x4a, 0xa0, 0x0b, 0x56, + 0xe5, 0x46, 0x37, 0xe5, 0xcb, 0x52, 0x33, 0x51, 0x32, 0x90, 0xe1, 0x93, 0xa6, 0x16, 0x7a, 0x0e, + 0x3c, 0xa8, 0xb9, 0x23, 0x80, 0xb7, 0x7b, 0x6a, 0x20, 0xc9, 0x8b, 0xbf, 0xe9, 0xc2, 0x5a, 0x60, + 0x05, 0x95, 0x0e, 0x9f, 0x36, 0x55, 0x3d, 0xff, 0x43, 0xf5, 0x4d, 0xcd, 0x0c, 0x04, 0xa9, 0x2d, + 0xa5, 0x12, 0x32, 0xbc, 0x05, 0xb9, 0xb1, 0x9a, 0x02, 0xa5, 0x66, 0x58, 0x85, 0xed, 0xa6, 0x92, + 0xa1, 0xa3, 0x4e, 0x6a, 0xe8, 0x08, 0x60, 0xec, 0x90, 0xc1, 0x47, 0xd2, 0xd3, 0x85, 0x04, 0x55, + 0x60, 0x39, 0x4b, 0x6b, 0xed, 0x19, 0x9b, 0xcf, 0x41, 0x42, 0x95, 0x41, 0x78, 0xd6, 0x38, 0xe4, + 0x9e, 0xfa, 0xde, 0x42, 0x87, 0x7b, 0xe6, 0x41, 0xc8, 0xa3, 0x87, 0x7d, 0x0c, 0xe9, 0xff, 0x63, + 0xc8, 0x83, 0x77, 0x7d, 0x0c, 0xd9, 0x23, 0x1d, 0xa3, 0x30, 0x83, 0x0a, 0x79, 0xd8, 0x31, 0xfc, + 0x89, 0x3f, 0x07, 0x18, 0x9a, 0xfa, 0xea, 0xb3, 0x47, 0xc8, 0x7f, 0xfb, 0x53, 0x8e, 0x67, 0xfb, + 0xe4, 0xf7, 0xd9, 0x3e, 0x32, 0x76, 0x7a, 0x6c, 0x6c, 0x30, 0xb8, 0xdb, 0x46, 0xde, 0xfd, 0x36, + 0xf2, 0x7e, 0x6e, 0x23, 0xef, 0xd3, 0x2e, 0x6a, 0xdd, 0xef, 0xa2, 0xd6, 0xf7, 0x5d, 0xd4, 0xfa, + 0xd0, 0xcf, 0x99, 0x2e, 0x96, 0xd3, 0x38, 0x43, 0x9e, 0x98, 0x45, 0x71, 0x5d, 0x81, 0x5e, 0xa1, + 0x5c, 0xd8, 0x22, 0x59, 0xdb, 0x9d, 0xa2, 0x37, 0x02, 0xd4, 0xb4, 0x6d, 0x77, 0xc2, 0xeb, 0x5f, + 0x01, 0x00, 0x00, 0xff, 0xff, 0x04, 0xc3, 0x7b, 0x1a, 0x6c, 0x04, 0x00, 0x00, } func (m *LegacyPoolParams) Marshal() (dAtA []byte, err error) { @@ -212,7 +202,7 @@ func (m *LegacyPoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.FeeDenom) i = encodeVarintPoolParams(dAtA, i, uint64(len(m.FeeDenom))) i-- - dAtA[i] = 0x52 + dAtA[i] = 0x4a } { size := m.WeightBreakingFeePortion.Size() @@ -223,7 +213,7 @@ func (m *LegacyPoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintPoolParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x4a + dAtA[i] = 0x42 { size := m.ThresholdWeightDifference.Size() i -= size @@ -233,7 +223,7 @@ func (m *LegacyPoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintPoolParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a { size := m.WeightRecoveryFeePortion.Size() i -= size @@ -243,16 +233,6 @@ func (m *LegacyPoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintPoolParams(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x3a - { - size := m.ExternalLiquidityRatio.Size() - i -= size - if _, err := m.ExternalLiquidityRatio.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x32 { size := m.WeightBreakingFeeExponent.Size() @@ -332,58 +312,8 @@ func (m *PoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { copy(dAtA[i:], m.FeeDenom) i = encodeVarintPoolParams(dAtA, i, uint64(len(m.FeeDenom))) i-- - dAtA[i] = 0x4a - } - { - size := m.WeightBreakingFeePortion.Size() - i -= size - if _, err := m.WeightBreakingFeePortion.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - { - size := m.ThresholdWeightDifference.Size() - i -= size - if _, err := m.ThresholdWeightDifference.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - { - size := m.WeightRecoveryFeePortion.Size() - i -= size - if _, err := m.WeightRecoveryFeePortion.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) + dAtA[i] = 0x1a } - i-- - dAtA[i] = 0x32 - { - size := m.WeightBreakingFeeExponent.Size() - i -= size - if _, err := m.WeightBreakingFeeExponent.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - { - size := m.WeightBreakingFeeMultiplier.Size() - i -= size - if _, err := m.WeightBreakingFeeMultiplier.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x22 if m.UseOracle { i-- if m.UseOracle { @@ -392,18 +322,8 @@ func (m *PoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0 } i-- - dAtA[i] = 0x18 - } - { - size := m.ExitFee.Size() - i -= size - if _, err := m.ExitFee.MarshalTo(dAtA[i:]); err != nil { - return 0, err - } - i = encodeVarintPoolParams(dAtA, i, uint64(size)) + dAtA[i] = 0x10 } - i-- - dAtA[i] = 0x12 { size := m.SwapFee.Size() i -= size @@ -445,8 +365,6 @@ func (m *LegacyPoolParams) Size() (n int) { n += 1 + l + sovPoolParams(uint64(l)) l = m.WeightBreakingFeeExponent.Size() n += 1 + l + sovPoolParams(uint64(l)) - l = m.ExternalLiquidityRatio.Size() - n += 1 + l + sovPoolParams(uint64(l)) l = m.WeightRecoveryFeePortion.Size() n += 1 + l + sovPoolParams(uint64(l)) l = m.ThresholdWeightDifference.Size() @@ -468,21 +386,9 @@ func (m *PoolParams) Size() (n int) { _ = l l = m.SwapFee.Size() n += 1 + l + sovPoolParams(uint64(l)) - l = m.ExitFee.Size() - n += 1 + l + sovPoolParams(uint64(l)) if m.UseOracle { n += 2 } - l = m.WeightBreakingFeeMultiplier.Size() - n += 1 + l + sovPoolParams(uint64(l)) - l = m.WeightBreakingFeeExponent.Size() - n += 1 + l + sovPoolParams(uint64(l)) - l = m.WeightRecoveryFeePortion.Size() - n += 1 + l + sovPoolParams(uint64(l)) - l = m.ThresholdWeightDifference.Size() - n += 1 + l + sovPoolParams(uint64(l)) - l = m.WeightBreakingFeePortion.Size() - n += 1 + l + sovPoolParams(uint64(l)) l = len(m.FeeDenom) if l > 0 { n += 1 + l + sovPoolParams(uint64(l)) @@ -682,40 +588,6 @@ func (m *LegacyPoolParams) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExternalLiquidityRatio", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExternalLiquidityRatio.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field WeightRecoveryFeePortion", wireType) } @@ -749,7 +621,7 @@ func (m *LegacyPoolParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ThresholdWeightDifference", wireType) } @@ -783,7 +655,7 @@ func (m *LegacyPoolParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 9: + case 8: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeePortion", wireType) } @@ -817,7 +689,7 @@ func (m *LegacyPoolParams) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 10: + case 9: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) } @@ -934,40 +806,6 @@ func (m *PoolParams) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExitFee", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExitFee.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field UseOracle", wireType) } @@ -987,177 +825,7 @@ func (m *PoolParams) Unmarshal(dAtA []byte) error { } } m.UseOracle = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeMultiplier", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.WeightBreakingFeeMultiplier.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeeExponent", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.WeightBreakingFeeExponent.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WeightRecoveryFeePortion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.WeightRecoveryFeePortion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ThresholdWeightDifference", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ThresholdWeightDifference.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WeightBreakingFeePortion", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowPoolParams - } - 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 ErrInvalidLengthPoolParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthPoolParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.WeightBreakingFeePortion.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 9: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field FeeDenom", wireType) } diff --git a/x/amm/types/pool_params_test.go b/x/amm/types/pool_params_test.go new file mode 100644 index 000000000..8ee5f3523 --- /dev/null +++ b/x/amm/types/pool_params_test.go @@ -0,0 +1,66 @@ +package types_test + +import ( + sdkmath "cosmossdk.io/math" + "github.com/elys-network/elys/x/amm/types" +) + +func (suite *TestSuite) TestPoolParamsValidate() { + suite.SetupTest() + poolParams := types.PoolParams{ + SwapFee: sdkmath.LegacyDec{}, + UseOracle: false, + FeeDenom: "", + } + for _, tc := range []struct { + name string + errorMsg string + function func() + }{ + { + name: "swap fee is nil", + errorMsg: "swap_fee is nil", + function: func() { + }, + }, + { + name: "swap fee is -ve", + errorMsg: types.ErrNegativeSwapFee.Error(), + function: func() { + poolParams.SwapFee = sdkmath.LegacyOneDec().MulInt64(-1) + }, + }, + { + name: "swap fee is 1", + errorMsg: types.ErrTooMuchSwapFee.Error(), + function: func() { + poolParams.SwapFee = sdkmath.LegacyOneDec() + }, + }, + { + name: "invalid fee denom", + errorMsg: "invalid denom: %%%", + function: func() { + poolParams.SwapFee = sdkmath.LegacyMustNewDecFromStr("0.001") + poolParams.FeeDenom = "%%%" + }, + }, + { + name: "success", + errorMsg: "", + function: func() { + poolParams.FeeDenom = "uatom" + }, + }, + } { + suite.Run(tc.name, func() { + tc.function() + err := poolParams.Validate() + if err != nil { + suite.Require().Equal(tc.errorMsg, err.Error()) + } else { + suite.Require().Equal(tc.errorMsg, "") + } + }) + } +} diff --git a/x/amm/types/swap_in_amt_given_out.go b/x/amm/types/swap_in_amt_given_out.go index a9a0636a1..bfc8348e5 100644 --- a/x/amm/types/swap_in_amt_given_out.go +++ b/x/amm/types/swap_in_amt_given_out.go @@ -50,7 +50,7 @@ func (p Pool) CalcGivenOutSlippage( // weightBreakingFeePerpetualFactor should be 1 if perpetual is not the one calling this function func (p *Pool) SwapInAmtGivenOut( ctx sdk.Context, oracleKeeper OracleKeeper, snapshot *Pool, - tokensOut sdk.Coins, tokenInDenom string, swapFee sdkmath.LegacyDec, accPoolKeeper AccountedPoolKeeper, weightBreakingFeePerpetualFactor math.LegacyDec) ( + tokensOut sdk.Coins, tokenInDenom string, swapFee sdkmath.LegacyDec, accPoolKeeper AccountedPoolKeeper, weightBreakingFeePerpetualFactor math.LegacyDec, params Params) ( tokenIn sdk.Coin, slippage, slippageAmount sdkmath.LegacyDec, weightBalanceBonus sdkmath.LegacyDec, err error, ) { // early return with balancer swap if normal amm pool @@ -135,12 +135,12 @@ func (p *Pool) SwapInAmtGivenOut( // weight breaking fee as in Plasma pool weightIn := GetDenomOracleAssetWeight(ctx, p.PoolId, oracleKeeper, newAssetPools, tokenInDenom) weightOut := GetDenomOracleAssetWeight(ctx, p.PoolId, oracleKeeper, newAssetPools, tokenOut.Denom) - weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, p.PoolParams, distanceDiff) + weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, distanceDiff, params) // weightBreakingFeePerpetualFactor is 1 if not send by perpetual weightBreakingFee = weightBreakingFee.Mul(weightBreakingFeePerpetualFactor) // weight recovery reward = weight breaking fee * weight recovery fee portion - weightRecoveryReward := weightBreakingFee.Mul(p.PoolParams.WeightRecoveryFeePortion) + weightRecoveryReward := weightBreakingFee.Mul(params.WeightRecoveryFeePortion) // bonus is valid when distance is lower than original distance and when threshold weight reached weightBalanceBonus = weightBreakingFee.Neg() @@ -151,7 +151,7 @@ func (p *Pool) SwapInAmtGivenOut( weightBalanceBonus = sdkmath.LegacyZeroDec() // set weight breaking fee to zero if bonus is applied - if initialWeightDistance.GT(p.PoolParams.ThresholdWeightDifference) { + if initialWeightDistance.GT(params.ThresholdWeightDifference) { weightBalanceBonus = weightRecoveryReward } } diff --git a/x/amm/types/swap_in_amt_given_out_test.go b/x/amm/types/swap_in_amt_given_out_test.go index 3e2dac7eb..f09740635 100644 --- a/x/amm/types/swap_in_amt_given_out_test.go +++ b/x/amm/types/swap_in_amt_given_out_test.go @@ -213,18 +213,20 @@ func (suite *TestSuite) TestSwapInAmtGivenOut() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - UseOracle: tc.useOracle, - ThresholdWeightDifference: tc.thresholdWeightDiff, - WeightBreakingFeeMultiplier: sdkmath.LegacyNewDecWithPrec(2, 4), // 0.02% - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: tc.useOracle, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: tc.poolAssets, TotalWeight: sdkmath.ZeroInt(), } - tokenOut, _, _, weightBonus, err := pool.SwapInAmtGivenOut(suite.ctx, suite.app.OracleKeeper, &pool, sdk.Coins{tc.tokenOut}, tc.inTokenDenom, tc.swapFee, suite.app.AccountedPoolKeeper, math.LegacyOneDec()) + params := suite.app.AmmKeeper.GetParams(suite.ctx) + params.ThresholdWeightDifference = tc.thresholdWeightDiff + params.WeightBreakingFeeMultiplier = sdkmath.LegacyNewDecWithPrec(2, 4) + params.WeightBreakingFeeExponent = sdkmath.LegacyNewDecWithPrec(25, 1) // 2.5 + params.WeightRecoveryFeePortion = sdkmath.LegacyNewDecWithPrec(50, 2) // 50% + tokenOut, _, _, weightBonus, err := pool.SwapInAmtGivenOut(suite.ctx, suite.app.OracleKeeper, &pool, sdk.Coins{tc.tokenOut}, tc.inTokenDenom, tc.swapFee, suite.app.AccountedPoolKeeper, math.LegacyOneDec(), params) if tc.expErr { suite.Require().Error(err) suite.Require().EqualError(err, "amount too low") diff --git a/x/amm/types/swap_out_amt_given_in.go b/x/amm/types/swap_out_amt_given_in.go index cbde6ea1b..378fbe513 100644 --- a/x/amm/types/swap_out_amt_given_in.go +++ b/x/amm/types/swap_out_amt_given_in.go @@ -179,6 +179,7 @@ func (p *Pool) SwapOutAmtGivenIn( swapFee sdkmath.LegacyDec, accPoolKeeper AccountedPoolKeeper, weightBreakingFeePerpetualFactor math.LegacyDec, + params Params, ) (tokenOut sdk.Coin, slippage, slippageAmount sdkmath.LegacyDec, weightBalanceBonus sdkmath.LegacyDec, err error) { balancerOutCoin, slippage, err := p.CalcOutAmtGivenIn(ctx, oracleKeeper, snapshot, tokensIn, tokenOutDenom, swapFee, accPoolKeeper) if err != nil { @@ -304,13 +305,13 @@ func (p *Pool) SwapOutAmtGivenIn( // weight breaking fee as in Plasma pool weightIn := GetDenomOracleAssetWeight(ctx, p.PoolId, oracleKeeper, newAssetPools, tokenIn.Denom) weightOut := GetDenomOracleAssetWeight(ctx, p.PoolId, oracleKeeper, newAssetPools, tokenOutDenom) - weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, p.PoolParams, distanceDiff) + weightBreakingFee := GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut, distanceDiff, params) // weightBreakingFeePerpetualFactor is 1 if not send by perpetual weightBreakingFee = weightBreakingFee.Mul(weightBreakingFeePerpetualFactor) // weight recovery reward = weight breaking fee * weight recovery fee portion - weightRecoveryReward := weightBreakingFee.Mul(p.PoolParams.WeightRecoveryFeePortion) + weightRecoveryReward := weightBreakingFee.Mul(params.WeightRecoveryFeePortion) // bonus is valid when distance is lower than original distance and when threshold weight reached weightBalanceBonus = weightBreakingFee.Neg() @@ -321,7 +322,7 @@ func (p *Pool) SwapOutAmtGivenIn( weightBalanceBonus = sdkmath.LegacyZeroDec() // set weight breaking fee to zero if bonus is applied - if initialWeightDistance.GT(p.PoolParams.ThresholdWeightDifference) { + if initialWeightDistance.GT(params.ThresholdWeightDifference) { weightBalanceBonus = weightRecoveryReward } } diff --git a/x/amm/types/swap_out_amt_given_in_test.go b/x/amm/types/swap_out_amt_given_in_test.go index 53b2c4272..4f562290c 100644 --- a/x/amm/types/swap_out_amt_given_in_test.go +++ b/x/amm/types/swap_out_amt_given_in_test.go @@ -625,18 +625,20 @@ func (suite *TestSuite) TestSwapOutAmtGivenIn() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: types.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - UseOracle: tc.useOracle, - ThresholdWeightDifference: tc.thresholdWeightDiff, - WeightBreakingFeeMultiplier: sdkmath.LegacyNewDecWithPrec(2, 4), // 0.02% - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: tc.useOracle, + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.Coin{}, PoolAssets: tc.poolAssets, TotalWeight: sdkmath.ZeroInt(), } - tokenOut, _, _, weightBonus, err := pool.SwapOutAmtGivenIn(suite.ctx, suite.app.OracleKeeper, &pool, sdk.Coins{tc.tokenIn}, tc.outTokenDenom, tc.swapFee, suite.app.AccountedPoolKeeper, math.LegacyOneDec()) + params := suite.app.AmmKeeper.GetParams(suite.ctx) + params.ThresholdWeightDifference = tc.thresholdWeightDiff + params.WeightBreakingFeeMultiplier = sdkmath.LegacyNewDecWithPrec(2, 4) + params.WeightBreakingFeeExponent = sdkmath.LegacyNewDecWithPrec(25, 1) // 2.5 + params.WeightRecoveryFeePortion = sdkmath.LegacyNewDecWithPrec(50, 2) // 50% + tokenOut, _, _, weightBonus, err := pool.SwapOutAmtGivenIn(suite.ctx, suite.app.OracleKeeper, &pool, sdk.Coins{tc.tokenIn}, tc.outTokenDenom, tc.swapFee, suite.app.AccountedPoolKeeper, math.LegacyOneDec(), params) if tc.expErr { suite.Require().Error(err) suite.Require().EqualError(err, "amount too low") diff --git a/x/amm/types/tx.pb.go b/x/amm/types/tx.pb.go index 64cabe87d..243168dde 100644 --- a/x/amm/types/tx.pb.go +++ b/x/amm/types/tx.pb.go @@ -35,7 +35,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type MsgCreatePool struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - PoolParams *PoolParams `protobuf:"bytes,2,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` + PoolParams PoolParams `protobuf:"bytes,2,opt,name=pool_params,json=poolParams,proto3" json:"pool_params"` PoolAssets []PoolAsset `protobuf:"bytes,3,rep,name=pool_assets,json=poolAssets,proto3" json:"pool_assets"` } @@ -79,11 +79,11 @@ func (m *MsgCreatePool) GetSender() string { return "" } -func (m *MsgCreatePool) GetPoolParams() *PoolParams { +func (m *MsgCreatePool) GetPoolParams() PoolParams { if m != nil { return m.PoolParams } - return nil + return PoolParams{} } func (m *MsgCreatePool) GetPoolAssets() []PoolAsset { @@ -942,9 +942,9 @@ func (m *MsgSwapByDenomResponse) GetRecipient() string { } type MsgUpdatePoolParams struct { - Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` - PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - PoolParams *PoolParams `protobuf:"bytes,3,opt,name=pool_params,json=poolParams,proto3" json:"pool_params,omitempty"` + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + PoolId uint64 `protobuf:"varint,2,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + PoolParams PoolParams `protobuf:"bytes,3,opt,name=pool_params,json=poolParams,proto3" json:"pool_params"` } func (m *MsgUpdatePoolParams) Reset() { *m = MsgUpdatePoolParams{} } @@ -994,11 +994,11 @@ func (m *MsgUpdatePoolParams) GetPoolId() uint64 { return 0 } -func (m *MsgUpdatePoolParams) GetPoolParams() *PoolParams { +func (m *MsgUpdatePoolParams) GetPoolParams() PoolParams { if m != nil { return m.PoolParams } - return nil + return PoolParams{} } type MsgUpdatePoolParamsResponse struct { @@ -1167,101 +1167,102 @@ func init() { func init() { proto.RegisterFile("elys/amm/tx.proto", fileDescriptor_ed7ddafd861f6b7f) } var fileDescriptor_ed7ddafd861f6b7f = []byte{ - // 1500 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0xc6, 0x89, 0x3f, 0x5e, 0x9a, 0x26, 0xde, 0x24, 0xc4, 0x71, 0x5a, 0x27, 0x5d, 0xa0, - 0x98, 0xa0, 0xda, 0x24, 0x40, 0x51, 0xad, 0x0a, 0xa8, 0x9b, 0xb4, 0x32, 0x8a, 0x95, 0xc8, 0x51, - 0x25, 0x54, 0x10, 0xd6, 0xc6, 0x9e, 0x3a, 0xab, 0x7a, 0x77, 0x8c, 0x67, 0xdc, 0x3a, 0x5c, 0x40, - 0xbd, 0xc1, 0x05, 0x6e, 0x1c, 0xf8, 0x07, 0xb8, 0x91, 0x43, 0x8f, 0x48, 0x5c, 0x8b, 0xb8, 0x94, - 0x5e, 0x40, 0x1c, 0x2a, 0x94, 0x1e, 0xfa, 0x67, 0x80, 0xe6, 0x63, 0x3f, 0xfd, 0x11, 0x77, 0x9b, - 0x0b, 0x97, 0xc4, 0xfb, 0xde, 0xbc, 0xdf, 0xcc, 0xfc, 0xde, 0x6f, 0xde, 0xbe, 0x59, 0x48, 0xa2, - 0xe6, 0x21, 0xc9, 0xeb, 0xa6, 0x99, 0xa7, 0xdd, 0x5c, 0xab, 0x8d, 0x29, 0x56, 0xe3, 0xcc, 0x94, - 0xd3, 0x4d, 0x33, 0x3d, 0xdf, 0xc0, 0x0d, 0xcc, 0x8d, 0x79, 0xf6, 0x4b, 0xf8, 0xd3, 0x99, 0x1a, - 0x26, 0x26, 0x26, 0xf9, 0x7d, 0x9d, 0xa0, 0xfc, 0xbd, 0xf5, 0x7d, 0x44, 0xf5, 0xf5, 0x7c, 0x0d, - 0x1b, 0x96, 0xf4, 0x2f, 0x38, 0x90, 0x2d, 0xbd, 0xad, 0x9b, 0x44, 0x9a, 0x97, 0x1c, 0x33, 0xb9, - 0xaf, 0xb7, 0xaa, 0x6d, 0xdc, 0xa1, 0x48, 0xba, 0xd2, 0x6e, 0x04, 0xc6, 0xcd, 0xea, 0x80, 0x30, - 0xee, 0xd3, 0x09, 0x41, 0x54, 0xba, 0x16, 0xe5, 0x42, 0x4c, 0xd2, 0xc8, 0xdf, 0x5b, 0x67, 0xff, - 0xa4, 0x23, 0xa9, 0x9b, 0x86, 0x85, 0xf3, 0xfc, 0xaf, 0x0d, 0x23, 0xc6, 0x56, 0xc5, 0x6e, 0xc4, - 0x83, 0x70, 0x69, 0x7f, 0x2a, 0x30, 0x5d, 0x26, 0x8d, 0xeb, 0x6d, 0xa4, 0x53, 0xb4, 0x8b, 0x71, - 0x53, 0x7d, 0x1b, 0xa2, 0x04, 0x59, 0x75, 0xd4, 0x4e, 0x29, 0xab, 0x4a, 0x36, 0x51, 0x4c, 0x3d, - 0x79, 0x78, 0x69, 0x5e, 0xc6, 0x5c, 0xab, 0xd7, 0xdb, 0x88, 0x90, 0x3d, 0xda, 0x36, 0xac, 0x46, - 0x45, 0x8e, 0x53, 0xdf, 0x83, 0x29, 0xcf, 0xd2, 0x53, 0xe3, 0xab, 0x4a, 0x76, 0x6a, 0x63, 0x3e, - 0x67, 0x33, 0x99, 0x63, 0xb0, 0xbb, 0xdc, 0x57, 0x81, 0x96, 0xf3, 0x5b, 0x2d, 0xc8, 0x30, 0xbe, - 0x2b, 0x92, 0x8a, 0xac, 0x46, 0xb2, 0x53, 0x1b, 0x73, 0xfe, 0xb0, 0x6b, 0xcc, 0x57, 0x9c, 0x78, - 0xf4, 0x74, 0x65, 0x4c, 0xc4, 0x72, 0x03, 0x29, 0x5c, 0x78, 0xf0, 0xfc, 0x68, 0x4d, 0xce, 0xff, - 0xed, 0xf3, 0xa3, 0xb5, 0x24, 0xe3, 0xc8, 0xb7, 0x0f, 0xed, 0x2a, 0x2c, 0xf8, 0x0c, 0x15, 0x44, - 0x5a, 0xd8, 0x22, 0x48, 0x7d, 0x15, 0x62, 0x7c, 0x5e, 0xa3, 0xce, 0x77, 0x38, 0x51, 0x84, 0xe3, - 0xa7, 0x2b, 0x51, 0x36, 0xa4, 0xb4, 0x59, 0x89, 0x32, 0x57, 0xa9, 0xae, 0xfd, 0x30, 0x0e, 0x53, - 0x65, 0xd2, 0xf8, 0x18, 0x1b, 0x56, 0x48, 0x56, 0x16, 0xdd, 0x69, 0x18, 0x23, 0x13, 0x36, 0xb4, - 0xba, 0x05, 0x67, 0x4d, 0xbd, 0x5b, 0xd5, 0x4d, 0xdc, 0xb1, 0x28, 0xa9, 0x1a, 0x96, 0xdc, 0xfa, - 0x52, 0x4e, 0xe2, 0x31, 0x6d, 0xe5, 0xa4, 0xb6, 0x72, 0xd7, 0xb1, 0x61, 0x49, 0x02, 0xce, 0x98, - 0x7a, 0xf7, 0x9a, 0x88, 0x2a, 0x59, 0xea, 0x2d, 0x98, 0x25, 0x07, 0x7a, 0x1b, 0x49, 0xa0, 0x2a, - 0xee, 0xd0, 0xd4, 0x04, 0x5f, 0xdb, 0x5b, 0x6c, 0xf4, 0xdf, 0x4f, 0x57, 0x16, 0x04, 0x1e, 0xa9, - 0xdf, 0xcd, 0x19, 0x38, 0x6f, 0xea, 0xf4, 0x20, 0x57, 0xb2, 0xe8, 0x93, 0x87, 0x97, 0x40, 0x4e, - 0x54, 0xb2, 0x68, 0xe5, 0x2c, 0x07, 0x11, 0xb0, 0x3b, 0x1d, 0x5a, 0x58, 0x09, 0x30, 0x3b, 0x23, - 0x99, 0xb5, 0x99, 0xd0, 0x7e, 0x52, 0x60, 0xce, 0xf3, 0xec, 0xd0, 0xda, 0x6f, 0x3d, 0xca, 0x4b, - 0xaf, 0x47, 0x2d, 0x40, 0x9c, 0xe2, 0xbb, 0xc8, 0x62, 0x3c, 0x8d, 0x8f, 0xc6, 0x53, 0x8c, 0x07, - 0x94, 0x2c, 0xed, 0x57, 0x91, 0xc4, 0xad, 0xae, 0x41, 0x4f, 0x3b, 0x89, 0x37, 0x61, 0xc6, 0x34, - 0x2c, 0x27, 0x89, 0x6c, 0xb3, 0x23, 0x66, 0x71, 0xda, 0x34, 0x2c, 0x99, 0x45, 0xb6, 0xbf, 0x3d, - 0x98, 0xf1, 0xd1, 0x66, 0x58, 0x61, 0xb2, 0x38, 0xed, 0x61, 0xad, 0x64, 0xa9, 0x17, 0x61, 0x46, - 0x90, 0x86, 0x3b, 0xb4, 0x5a, 0x47, 0x16, 0x36, 0x53, 0x93, 0x0c, 0xb4, 0x32, 0xcd, 0xcd, 0x3b, - 0x1d, 0xba, 0xc9, 0x8c, 0x03, 0x93, 0x6d, 0x33, 0xa6, 0xed, 0xf1, 0x5c, 0xdb, 0x8f, 0x4e, 0xae, - 0xaf, 0x42, 0xc2, 0xc1, 0x4f, 0x29, 0xa3, 0xed, 0x3b, 0x6e, 0x4f, 0xad, 0xfd, 0x3b, 0x0e, 0xf3, - 0x65, 0xd2, 0xd8, 0xbb, 0xaf, 0xb7, 0xb6, 0xba, 0x7a, 0x8d, 0x3a, 0xcb, 0x7e, 0xf1, 0xfc, 0x5c, - 0x81, 0x28, 0xaf, 0xa5, 0x44, 0x6a, 0x63, 0xd9, 0x2d, 0x1f, 0x0c, 0xde, 0x46, 0xae, 0xb0, 0x31, - 0x72, 0x1d, 0x32, 0xc0, 0x27, 0xac, 0x08, 0x2f, 0x59, 0x23, 0x0b, 0x4b, 0xfd, 0x0c, 0xe6, 0x5d, - 0x7e, 0x5d, 0x1d, 0x84, 0xc9, 0x5c, 0xd2, 0xa6, 0xa5, 0x6c, 0xcb, 0x42, 0xbd, 0x0c, 0x89, 0x36, - 0xaa, 0x19, 0x2d, 0x03, 0x59, 0x54, 0xe4, 0x6d, 0x08, 0x13, 0xee, 0xd0, 0x42, 0x36, 0x90, 0xcd, - 0x94, 0xcc, 0x66, 0x0f, 0xd1, 0xda, 0xd1, 0x38, 0x9c, 0xeb, 0xe7, 0xf0, 0x1e, 0x66, 0x77, 0x83, - 0x72, 0x73, 0x61, 0x0e, 0xb3, 0xbd, 0x39, 0xb9, 0xb3, 0x6d, 0x88, 0xf3, 0xf7, 0xdf, 0x1d, 0x84, - 0xf8, 0x79, 0x4a, 0x14, 0xd7, 0x25, 0xdc, 0x72, 0x2f, 0xdc, 0x36, 0x6a, 0xe8, 0xb5, 0xc3, 0x4d, - 0x54, 0xf3, 0x80, 0x6e, 0xa2, 0x5a, 0x25, 0xc6, 0x20, 0x6e, 0x20, 0xa4, 0x96, 0x21, 0x5e, 0x37, - 0x48, 0x8d, 0x2f, 0x2e, 0x12, 0x16, 0xcd, 0x81, 0x50, 0xcf, 0x79, 0x69, 0xe7, 0x99, 0xf4, 0x90, - 0xab, 0x3d, 0x88, 0xf0, 0xf7, 0x49, 0x80, 0x32, 0x76, 0x82, 0x5f, 0x5c, 0xb5, 0x85, 0x80, 0x6a, - 0xcf, 0xf5, 0x53, 0xed, 0x4e, 0x87, 0xf6, 0x93, 0xad, 0xef, 0xe8, 0x8d, 0xa8, 0x5b, 0xe7, 0xe8, - 0xa9, 0xb7, 0x61, 0xce, 0x16, 0x7d, 0xd5, 0x7d, 0x09, 0x85, 0xd1, 0xed, 0xac, 0x3c, 0x0b, 0x65, - 0xfb, 0x9d, 0x14, 0x5a, 0xb6, 0x6f, 0x06, 0x64, 0xbb, 0xd4, 0x5f, 0xb6, 0xac, 0x72, 0xfc, 0x3c, - 0x0e, 0xe7, 0xfb, 0x7a, 0x1c, 0xe1, 0xee, 0xd9, 0x95, 0xcf, 0x3d, 0x94, 0x21, 0x74, 0x3b, 0x2d, - 0x37, 0xf7, 0xff, 0x97, 0xed, 0xef, 0x0a, 0xac, 0x96, 0x49, 0xe3, 0x06, 0x42, 0xf5, 0x72, 0xa7, - 0x49, 0x8d, 0x56, 0x13, 0x6d, 0x75, 0x29, 0x6a, 0x5b, 0x7a, 0x73, 0xdb, 0xf8, 0xa2, 0x63, 0xd4, - 0x0d, 0x7a, 0x18, 0x42, 0xc1, 0x1f, 0x42, 0xa2, 0x69, 0x87, 0xf7, 0x96, 0xde, 0x9e, 0x19, 0xa4, - 0x0e, 0xdd, 0x98, 0xc2, 0xbb, 0x81, 0xa4, 0xbf, 0x26, 0x93, 0x3e, 0x74, 0xa1, 0xda, 0x1a, 0x64, - 0x4f, 0x1a, 0x63, 0x2b, 0x41, 0xfb, 0x45, 0x81, 0x59, 0xde, 0x2d, 0x8a, 0x24, 0x6e, 0xa2, 0x16, - 0x3d, 0x50, 0xe7, 0x61, 0x92, 0xb7, 0x9b, 0x62, 0xa3, 0x15, 0xf1, 0xa0, 0x96, 0x20, 0x2a, 0xb5, - 0x12, 0x3a, 0xbb, 0x12, 0x40, 0xbd, 0x09, 0x93, 0x75, 0x36, 0x53, 0xf8, 0xcc, 0x8a, 0x78, 0xed, - 0x4b, 0x48, 0xf6, 0x26, 0x6a, 0x31, 0xd0, 0xba, 0x3a, 0xed, 0xc8, 0x36, 0x24, 0x65, 0xff, 0xc0, - 0xa3, 0xab, 0x86, 0x75, 0x07, 0xcb, 0xbc, 0xa4, 0xdd, 0xbc, 0x04, 0xe9, 0x90, 0x69, 0x99, 0xd1, - 0x5d, 0x53, 0xc9, 0xba, 0x83, 0xb5, 0xef, 0x22, 0x70, 0x56, 0x1e, 0xb3, 0xe2, 0x21, 0xef, 0x14, - 0x42, 0x48, 0xe4, 0x7d, 0x1f, 0xa9, 0x23, 0x54, 0x29, 0x9b, 0xc2, 0x0f, 0x00, 0x3c, 0xaf, 0xd4, - 0x11, 0x4b, 0x5c, 0xc2, 0xe9, 0xaa, 0x78, 0xbc, 0xbf, 0xb4, 0x8d, 0x14, 0xef, 0xd4, 0xb1, 0x25, - 0x88, 0xf3, 0x96, 0x89, 0x35, 0x06, 0xa2, 0x6b, 0x8a, 0xf1, 0xe7, 0x92, 0xa5, 0x2e, 0x43, 0x42, - 0xb8, 0x58, 0xf1, 0x8d, 0x72, 0x9f, 0x18, 0xcb, 0x6a, 0xab, 0xaf, 0xfe, 0xc5, 0x46, 0xaf, 0x7f, - 0x5a, 0xe0, 0x28, 0xa8, 0x9e, 0xfa, 0x27, 0xe9, 0xd7, 0xfe, 0x88, 0xc0, 0x2b, 0x7e, 0x93, 0x53, - 0xf1, 0x5c, 0x9e, 0x95, 0x17, 0xe3, 0xf9, 0x32, 0xc4, 0x0d, 0x4b, 0x5c, 0x45, 0x47, 0xe8, 0x9e, - 0x2a, 0x31, 0x43, 0xfc, 0x50, 0xaf, 0x40, 0x82, 0x75, 0x05, 0x22, 0x30, 0x72, 0xf2, 0x0b, 0xac, - 0x12, 0xc7, 0xf2, 0x97, 0xba, 0x0b, 0x40, 0x5a, 0x98, 0x56, 0x5b, 0x6d, 0xa3, 0x86, 0xe4, 0x5b, - 0x27, 0xc4, 0x11, 0x49, 0x30, 0x90, 0x5d, 0x86, 0xe1, 0x2b, 0xcd, 0x93, 0xa7, 0x5a, 0x9a, 0xa3, - 0xa7, 0x5c, 0x9a, 0x63, 0xc1, 0xd2, 0xfc, 0x9b, 0xb8, 0x48, 0xdd, 0x6a, 0xd5, 0xe5, 0x0d, 0x55, - 0xde, 0x8b, 0x2f, 0x43, 0x42, 0xef, 0xd0, 0x03, 0xdc, 0x66, 0xb5, 0xf5, 0xa4, 0xd3, 0xe6, 0x0e, - 0x1d, 0x7c, 0x57, 0x09, 0xdc, 0xcf, 0x23, 0xa3, 0xdd, 0xcf, 0x0b, 0x6b, 0x4c, 0x97, 0x2e, 0x3e, - 0x93, 0xe6, 0xa2, 0x94, 0x66, 0x70, 0xcd, 0x9a, 0x09, 0xcb, 0x7d, 0xcc, 0x8e, 0x46, 0x07, 0xd6, - 0xad, 0x70, 0x9f, 0x0e, 0xb4, 0x1f, 0x15, 0x98, 0x71, 0xe7, 0x7b, 0x39, 0xda, 0xb2, 0x10, 0xf5, - 0xcd, 0x3e, 0xeb, 0x99, 0x5d, 0xcc, 0x2c, 0xfd, 0x85, 0x8b, 0xbd, 0x84, 0xcc, 0xf9, 0x09, 0x11, - 0xab, 0x5b, 0x82, 0xc5, 0x80, 0xc9, 0x26, 0x62, 0xe3, 0x9b, 0x28, 0x44, 0xca, 0xa4, 0xa1, 0xde, - 0x00, 0xf0, 0x7c, 0x72, 0x59, 0x74, 0xa7, 0xf4, 0x7d, 0xb2, 0x48, 0xaf, 0x0c, 0x70, 0x38, 0xc4, - 0x7e, 0x04, 0x71, 0xe7, 0x13, 0xc5, 0x82, 0x6f, 0xb0, 0x6d, 0x4e, 0x9f, 0xef, 0x6b, 0xf6, 0x22, - 0x38, 0xf7, 0x63, 0x3f, 0x82, 0x6d, 0x0e, 0x20, 0xf4, 0x5c, 0x06, 0x3f, 0x85, 0x64, 0xef, 0x55, - 0x2e, 0xe3, 0x8b, 0xe9, 0xf1, 0xa7, 0x2f, 0x0e, 0xf7, 0x3b, 0xe0, 0x9f, 0x83, 0xda, 0xa7, 0xe5, - 0x5e, 0x19, 0x16, 0xbd, 0xd3, 0xa1, 0xe9, 0x37, 0x4e, 0x18, 0xe0, 0xe0, 0x97, 0x60, 0xca, 0xfb, - 0x9a, 0x4b, 0xf5, 0xc4, 0x49, 0x4f, 0x7a, 0x75, 0x90, 0xc7, 0x81, 0xfa, 0x0a, 0xce, 0x0f, 0x6f, - 0xb3, 0xd6, 0x7c, 0x10, 0x43, 0xc7, 0xa6, 0x37, 0x46, 0x1f, 0xeb, 0x2c, 0xe0, 0x13, 0x98, 0xed, - 0x29, 0x26, 0xfe, 0xdc, 0x05, 0xdd, 0xe9, 0xd7, 0x87, 0xba, 0x1d, 0xe4, 0x6d, 0x38, 0xe3, 0x3b, - 0x6b, 0x4b, 0xfd, 0xc2, 0x04, 0xe2, 0x85, 0x81, 0x2e, 0x1b, 0x2d, 0x3d, 0xf9, 0xf5, 0xf3, 0xa3, - 0x35, 0xa5, 0x58, 0x7c, 0x74, 0x9c, 0x51, 0x1e, 0x1f, 0x67, 0x94, 0x7f, 0x8e, 0x33, 0xca, 0xf7, - 0xcf, 0x32, 0x63, 0x8f, 0x9f, 0x65, 0xc6, 0xfe, 0x7a, 0x96, 0x19, 0xbb, 0x9d, 0x6d, 0x18, 0xf4, - 0xa0, 0xb3, 0x9f, 0xab, 0x61, 0x33, 0xcf, 0xd0, 0x2e, 0x59, 0x88, 0xde, 0xc7, 0xed, 0xbb, 0xfc, - 0x21, 0xdf, 0x15, 0x5f, 0x6c, 0x0f, 0x5b, 0x88, 0xec, 0x47, 0xf9, 0x57, 0xcc, 0x77, 0xfe, 0x0b, - 0x00, 0x00, 0xff, 0xff, 0xbd, 0xb5, 0x4c, 0x22, 0xca, 0x15, 0x00, 0x00, + // 1506 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x58, 0xcf, 0x6f, 0x1b, 0xc5, + 0x17, 0xcf, 0xc6, 0x89, 0x7f, 0xbc, 0x34, 0x4d, 0xbc, 0x49, 0xbe, 0x71, 0x9c, 0xd6, 0x49, 0xf7, + 0x0b, 0xc5, 0x04, 0xd5, 0x26, 0x01, 0x8a, 0x6a, 0x2a, 0xa0, 0x6e, 0xd2, 0xca, 0x28, 0x56, 0x22, + 0x47, 0x95, 0x50, 0x41, 0x58, 0x1b, 0x7b, 0xea, 0xac, 0xea, 0xdd, 0x31, 0x9e, 0x71, 0xeb, 0x70, + 0x01, 0xf5, 0x06, 0x17, 0xb8, 0x71, 0xe0, 0x1f, 0xe0, 0x46, 0x0e, 0x3d, 0x22, 0x71, 0xad, 0xc4, + 0x81, 0xd2, 0x13, 0x42, 0xa2, 0x42, 0xe9, 0xa1, 0x7f, 0x06, 0x68, 0x7e, 0xec, 0x4f, 0xff, 0x88, + 0xb3, 0xed, 0x85, 0x4b, 0xe2, 0x7d, 0x6f, 0xde, 0x67, 0x66, 0x3e, 0xef, 0x33, 0x6f, 0xdf, 0x2c, + 0x24, 0x51, 0xf3, 0x90, 0xe4, 0x75, 0xd3, 0xcc, 0xd3, 0x6e, 0xae, 0xd5, 0xc6, 0x14, 0xab, 0x71, + 0x66, 0xca, 0xe9, 0xa6, 0x99, 0x9e, 0x6f, 0xe0, 0x06, 0xe6, 0xc6, 0x3c, 0xfb, 0x25, 0xfc, 0xe9, + 0x4c, 0x0d, 0x13, 0x13, 0x93, 0xfc, 0xbe, 0x4e, 0x50, 0xfe, 0xde, 0xfa, 0x3e, 0xa2, 0xfa, 0x7a, + 0xbe, 0x86, 0x0d, 0x4b, 0xfa, 0x17, 0x1c, 0xc8, 0x96, 0xde, 0xd6, 0x4d, 0x22, 0xcd, 0x4b, 0x8e, + 0x99, 0xdc, 0xd7, 0x5b, 0xd5, 0x36, 0xee, 0x50, 0x24, 0x5d, 0x69, 0x37, 0x02, 0xe3, 0x66, 0x75, + 0x40, 0x18, 0xf7, 0xe9, 0x84, 0x20, 0x2a, 0x5d, 0x8b, 0x72, 0x21, 0x26, 0x69, 0xe4, 0xef, 0xad, + 0xb3, 0x7f, 0xd2, 0x91, 0xd4, 0x4d, 0xc3, 0xc2, 0x79, 0xfe, 0xd7, 0x86, 0x11, 0x63, 0xab, 0x62, + 0x37, 0xe2, 0x41, 0xb8, 0xb4, 0xbf, 0x14, 0x98, 0x2e, 0x93, 0xc6, 0xf5, 0x36, 0xd2, 0x29, 0xda, + 0xc5, 0xb8, 0xa9, 0xbe, 0x09, 0x51, 0x82, 0xac, 0x3a, 0x6a, 0xa7, 0x94, 0x55, 0x25, 0x9b, 0x28, + 0xa6, 0x9e, 0x3c, 0xbc, 0x34, 0x2f, 0x63, 0xae, 0xd5, 0xeb, 0x6d, 0x44, 0xc8, 0x1e, 0x6d, 0x1b, + 0x56, 0xa3, 0x22, 0xc7, 0xa9, 0xef, 0xc1, 0x94, 0x67, 0xe9, 0xa9, 0xf1, 0x55, 0x25, 0x3b, 0xb5, + 0x31, 0x9f, 0xb3, 0x99, 0xcc, 0x31, 0xd8, 0x5d, 0xee, 0x2b, 0x4e, 0x3c, 0x7a, 0xba, 0x32, 0x56, + 0x81, 0x96, 0x63, 0x51, 0x0b, 0x32, 0x98, 0xef, 0x8d, 0xa4, 0x22, 0xab, 0x91, 0xec, 0xd4, 0xc6, + 0x9c, 0x3f, 0xf8, 0x1a, 0xf3, 0x79, 0x63, 0xb9, 0x81, 0x14, 0x2e, 0x3c, 0x78, 0x7e, 0xb4, 0x26, + 0x57, 0xf1, 0xcd, 0xf3, 0xa3, 0xb5, 0x24, 0x63, 0xca, 0xb7, 0x1b, 0xed, 0x2a, 0x2c, 0xf8, 0x0c, + 0x15, 0x44, 0x5a, 0xd8, 0x22, 0x48, 0xfd, 0x3f, 0xc4, 0xf8, 0xbc, 0x46, 0x9d, 0xef, 0x73, 0xa2, + 0x08, 0xc7, 0x4f, 0x57, 0xa2, 0x6c, 0x48, 0x69, 0xb3, 0x12, 0x65, 0xae, 0x52, 0x5d, 0xfb, 0x7e, + 0x1c, 0xa6, 0xca, 0xa4, 0xf1, 0x11, 0x36, 0xac, 0x90, 0xdc, 0x2c, 0xba, 0xd3, 0x30, 0x5e, 0x26, + 0x6c, 0x68, 0x75, 0x0b, 0xce, 0x9a, 0x7a, 0xb7, 0xaa, 0x9b, 0xb8, 0x63, 0x51, 0x52, 0x35, 0x2c, + 0xb9, 0xf5, 0xa5, 0x9c, 0xc4, 0x63, 0x0a, 0xcb, 0x49, 0x85, 0xe5, 0xae, 0x63, 0xc3, 0x92, 0x04, + 0x9c, 0x31, 0xf5, 0xee, 0x35, 0x11, 0x55, 0xb2, 0xd4, 0x5b, 0x30, 0x4b, 0x0e, 0xf4, 0x36, 0x92, + 0x40, 0x55, 0xdc, 0xa1, 0xa9, 0x09, 0xbe, 0xb6, 0x37, 0xd8, 0xe8, 0x3f, 0x9f, 0xae, 0x2c, 0x08, + 0x3c, 0x52, 0xbf, 0x9b, 0x33, 0x70, 0xde, 0xd4, 0xe9, 0x41, 0xae, 0x64, 0xd1, 0x27, 0x0f, 0x2f, + 0x81, 0x9c, 0xa8, 0x64, 0xd1, 0xca, 0x59, 0x0e, 0x22, 0x60, 0x77, 0x3a, 0xb4, 0xb0, 0x12, 0x60, + 0x76, 0x46, 0x32, 0x6b, 0x33, 0xa1, 0xfd, 0xa8, 0xc0, 0x9c, 0xe7, 0xd9, 0xa1, 0xb5, 0xdf, 0x7a, + 0x94, 0x17, 0x5e, 0x8f, 0x5a, 0x80, 0x38, 0xc5, 0x77, 0x91, 0xc5, 0x78, 0x1a, 0x1f, 0x8d, 0xa7, + 0x18, 0x0f, 0x28, 0x59, 0xda, 0x2f, 0x22, 0x89, 0x5b, 0x5d, 0x83, 0xbe, 0xec, 0x24, 0xde, 0x84, + 0x19, 0xd3, 0xb0, 0x9c, 0x24, 0xb2, 0xcd, 0x8e, 0x98, 0xc5, 0x69, 0xd3, 0xb0, 0x64, 0x16, 0xd9, + 0xfe, 0xf6, 0x60, 0xc6, 0x47, 0x9b, 0x61, 0x85, 0xc9, 0xe2, 0xb4, 0x87, 0xb5, 0x92, 0xa5, 0x5e, + 0x84, 0x19, 0x41, 0x1a, 0xee, 0xd0, 0x6a, 0x1d, 0x59, 0xd8, 0x4c, 0x4d, 0x32, 0xd0, 0xca, 0x34, + 0x37, 0xef, 0x74, 0xe8, 0x26, 0x33, 0x0e, 0x4c, 0xb6, 0xcd, 0x98, 0xb6, 0xc7, 0x73, 0x6d, 0x3f, + 0x3a, 0xb9, 0xbe, 0x0a, 0x09, 0x07, 0x3f, 0xa5, 0x8c, 0xb6, 0xef, 0xb8, 0x3d, 0xb5, 0xf6, 0xcf, + 0x38, 0xcc, 0x97, 0x49, 0x63, 0xef, 0xbe, 0xde, 0xda, 0xea, 0xea, 0x35, 0xea, 0x2c, 0xfb, 0xf4, + 0xf9, 0xb9, 0x02, 0x51, 0x5e, 0x51, 0x89, 0xd4, 0xc6, 0xb2, 0x5b, 0x3e, 0x18, 0xbc, 0x8d, 0x5c, + 0x61, 0x63, 0xe4, 0x3a, 0x64, 0x80, 0x4f, 0x58, 0x11, 0x5e, 0xb8, 0x46, 0x16, 0x96, 0xfa, 0x29, + 0xcc, 0xbb, 0xfc, 0xba, 0x3a, 0x08, 0x93, 0xb9, 0xa4, 0x4d, 0x4b, 0xd9, 0x96, 0x85, 0x7a, 0x19, + 0x12, 0x6d, 0x54, 0x33, 0x5a, 0x06, 0xb2, 0xa8, 0xc8, 0xdb, 0x10, 0x26, 0xdc, 0xa1, 0x85, 0x6c, + 0x20, 0x9b, 0x29, 0x99, 0xcd, 0x1e, 0xa2, 0xb5, 0xa3, 0x71, 0x38, 0xd7, 0xcf, 0xe1, 0x3d, 0xcc, + 0xee, 0x06, 0xe5, 0xe6, 0xc2, 0x1c, 0x66, 0x7b, 0x73, 0x72, 0x67, 0xdb, 0x10, 0xe7, 0x6f, 0xc1, + 0x3b, 0x08, 0xf1, 0xf3, 0x94, 0x28, 0xae, 0x4b, 0xb8, 0xe5, 0x5e, 0xb8, 0x6d, 0xd4, 0xd0, 0x6b, + 0x87, 0x9b, 0xa8, 0xe6, 0x01, 0xdd, 0x44, 0xb5, 0x4a, 0x8c, 0x41, 0xdc, 0x40, 0x48, 0x2d, 0x43, + 0xbc, 0x6e, 0x90, 0x1a, 0x5f, 0x5c, 0x24, 0x2c, 0x9a, 0x03, 0xa1, 0x9e, 0xf3, 0xd2, 0xce, 0x33, + 0xe9, 0x21, 0x57, 0x7b, 0x10, 0xe1, 0xef, 0x93, 0x00, 0x65, 0xec, 0x04, 0x9f, 0x5e, 0xb5, 0x85, + 0x80, 0x6a, 0xcf, 0xf5, 0x53, 0xed, 0x4e, 0x87, 0xf6, 0x93, 0xad, 0xef, 0xe8, 0x8d, 0xa8, 0x5b, + 0xe7, 0xe8, 0xa9, 0xb7, 0x61, 0xce, 0x16, 0x7d, 0xd5, 0x7d, 0x09, 0x85, 0xd1, 0xed, 0xac, 0x3c, + 0x0b, 0x65, 0xfb, 0x9d, 0x14, 0x5a, 0xb6, 0xaf, 0x07, 0x64, 0xbb, 0xd4, 0x5f, 0xb6, 0xac, 0x72, + 0xfc, 0x34, 0x0e, 0xe7, 0xfb, 0x7a, 0x1c, 0xe1, 0xee, 0xd9, 0x95, 0xcf, 0x3d, 0x94, 0x21, 0x74, + 0x3b, 0x2d, 0x37, 0xf7, 0xdf, 0x97, 0xed, 0xaf, 0x0a, 0xac, 0x96, 0x49, 0xe3, 0x06, 0x42, 0xf5, + 0x72, 0xa7, 0x49, 0x8d, 0x56, 0x13, 0x6d, 0x75, 0x29, 0x6a, 0x5b, 0x7a, 0x73, 0xdb, 0xf8, 0xbc, + 0x63, 0xd4, 0x0d, 0x7a, 0x18, 0x42, 0xc1, 0x1f, 0x40, 0xa2, 0x69, 0x87, 0xf7, 0x96, 0xde, 0x9e, + 0x19, 0xa4, 0x0e, 0xdd, 0x98, 0xc2, 0xdb, 0x81, 0xa4, 0xbf, 0x22, 0x93, 0x3e, 0x74, 0xa1, 0xda, + 0x1a, 0x64, 0x4f, 0x1a, 0x63, 0x2b, 0x41, 0xfb, 0x59, 0x81, 0x59, 0xde, 0x2d, 0x8a, 0x24, 0x6e, + 0xa2, 0x16, 0x3d, 0x50, 0xe7, 0x61, 0x92, 0xb7, 0x9b, 0x62, 0xa3, 0x15, 0xf1, 0xa0, 0x96, 0x20, + 0x2a, 0xb5, 0x12, 0x3a, 0xbb, 0x12, 0x40, 0xbd, 0x09, 0x93, 0x75, 0x36, 0x53, 0xf8, 0xcc, 0x8a, + 0x78, 0xed, 0x0b, 0x48, 0xf6, 0x26, 0x6a, 0x31, 0xd0, 0xba, 0x3a, 0xed, 0xc8, 0x36, 0x24, 0x65, + 0xff, 0xc0, 0xa3, 0xab, 0x86, 0x75, 0x07, 0xcb, 0xbc, 0xa4, 0xdd, 0xbc, 0x04, 0xe9, 0x90, 0x69, + 0x99, 0xd1, 0x5d, 0x53, 0xc9, 0xba, 0x83, 0xb5, 0x6f, 0x23, 0x70, 0x56, 0x1e, 0xb3, 0xe2, 0x21, + 0xef, 0x14, 0x42, 0x48, 0xe4, 0x5d, 0x1f, 0xa9, 0x23, 0x54, 0x29, 0x9b, 0xc2, 0xf7, 0x01, 0x3c, + 0xaf, 0xd4, 0x11, 0x4b, 0x5c, 0xc2, 0xe9, 0xaa, 0x78, 0xbc, 0xbf, 0xb4, 0x8d, 0x14, 0xef, 0xd4, + 0xb1, 0x25, 0x88, 0xf3, 0x96, 0x89, 0x35, 0x06, 0xa2, 0x6b, 0x8a, 0xf1, 0xe7, 0x92, 0xa5, 0x2e, + 0x43, 0x42, 0xb8, 0x58, 0xf1, 0x8d, 0x72, 0x9f, 0x18, 0xcb, 0x6a, 0xab, 0xaf, 0xfe, 0xc5, 0x46, + 0xaf, 0x7f, 0x5a, 0xe0, 0x28, 0xa8, 0x9e, 0xfa, 0x27, 0xe9, 0xd7, 0x7e, 0x8f, 0xc0, 0xff, 0xfc, + 0x26, 0xa7, 0xe2, 0xb9, 0x3c, 0x2b, 0xa7, 0xe3, 0xf9, 0x32, 0xc4, 0x0d, 0x4b, 0x5c, 0x48, 0x47, + 0xe8, 0x9e, 0x2a, 0x31, 0x43, 0xfc, 0x50, 0xaf, 0x40, 0x82, 0x75, 0x05, 0x22, 0x30, 0x72, 0xf2, + 0x0b, 0xac, 0x12, 0xc7, 0xf2, 0x97, 0xba, 0x0b, 0x40, 0x5a, 0x98, 0x56, 0x5b, 0x6d, 0xa3, 0x86, + 0xe4, 0x5b, 0x27, 0xc4, 0x11, 0x49, 0x30, 0x90, 0x5d, 0x86, 0xe1, 0x2b, 0xcd, 0x93, 0x2f, 0xb5, + 0x34, 0x47, 0x5f, 0x72, 0x69, 0x8e, 0x05, 0x4b, 0xf3, 0x6f, 0xe2, 0x22, 0x75, 0xab, 0x55, 0x97, + 0x37, 0x54, 0x79, 0x2f, 0xbe, 0x0c, 0x09, 0xbd, 0x43, 0x0f, 0x70, 0x9b, 0xd5, 0xd6, 0x93, 0x4e, + 0x9b, 0x3b, 0x74, 0xf0, 0x5d, 0x25, 0x70, 0x4b, 0x8f, 0x9c, 0xe6, 0x96, 0x5e, 0x58, 0x63, 0xea, + 0x74, 0x67, 0x61, 0x02, 0x5d, 0x94, 0x02, 0x0d, 0xae, 0x5c, 0x33, 0x61, 0xb9, 0x8f, 0xd9, 0x51, + 0xea, 0xc0, 0xea, 0xf5, 0xce, 0xc8, 0x9f, 0x11, 0xbc, 0x4b, 0xd3, 0x7e, 0x50, 0x60, 0xc6, 0x9d, + 0xef, 0xc5, 0xc8, 0xcb, 0x42, 0xd4, 0x37, 0xfb, 0xac, 0x67, 0x76, 0x31, 0xb3, 0xf4, 0x17, 0x2e, + 0xf6, 0x12, 0x32, 0xe7, 0x27, 0x44, 0xac, 0x6e, 0x09, 0x16, 0x03, 0x26, 0x9b, 0x88, 0x8d, 0xaf, + 0xa3, 0x10, 0x29, 0x93, 0x86, 0x7a, 0x03, 0xc0, 0xf3, 0xf9, 0x65, 0xd1, 0x9d, 0xd2, 0xf7, 0xe1, + 0x22, 0xbd, 0x32, 0xc0, 0xe1, 0x10, 0xfb, 0x21, 0xc4, 0x9d, 0x0f, 0x15, 0x0b, 0xbe, 0xc1, 0xb6, + 0x39, 0x7d, 0xbe, 0xaf, 0xd9, 0x8b, 0xe0, 0xdc, 0x92, 0xfd, 0x08, 0xb6, 0x39, 0x80, 0xd0, 0x73, + 0x25, 0xfc, 0x04, 0x92, 0xbd, 0x17, 0xba, 0x8c, 0x2f, 0xa6, 0xc7, 0x9f, 0xbe, 0x38, 0xdc, 0xef, + 0x80, 0x7f, 0x06, 0x6a, 0x9f, 0xc6, 0x7b, 0x65, 0x58, 0xf4, 0x4e, 0x87, 0xa6, 0x5f, 0x3b, 0x61, + 0x80, 0x83, 0x5f, 0x82, 0x29, 0xef, 0xcb, 0x2e, 0xd5, 0x13, 0x27, 0x3d, 0xe9, 0xd5, 0x41, 0x1e, + 0x07, 0xea, 0x4b, 0x38, 0x3f, 0xbc, 0xd9, 0x5a, 0xf3, 0x41, 0x0c, 0x1d, 0x9b, 0xde, 0x18, 0x7d, + 0xac, 0xb3, 0x80, 0x8f, 0x61, 0xb6, 0xa7, 0xa4, 0xf8, 0x73, 0x17, 0x74, 0xa7, 0x5f, 0x1d, 0xea, + 0x76, 0x90, 0xb7, 0xe1, 0x8c, 0xef, 0xac, 0x2d, 0xf5, 0x0b, 0x13, 0x88, 0x17, 0x06, 0xba, 0x6c, + 0xb4, 0xf4, 0xe4, 0x57, 0xcf, 0x8f, 0xd6, 0x94, 0x62, 0xf1, 0xd1, 0x71, 0x46, 0x79, 0x7c, 0x9c, + 0x51, 0xfe, 0x3e, 0xce, 0x28, 0xdf, 0x3d, 0xcb, 0x8c, 0x3d, 0x7e, 0x96, 0x19, 0xfb, 0xe3, 0x59, + 0x66, 0xec, 0x76, 0xb6, 0x61, 0xd0, 0x83, 0xce, 0x7e, 0xae, 0x86, 0xcd, 0x3c, 0x43, 0xbb, 0x64, + 0x21, 0x7a, 0x1f, 0xb7, 0xef, 0xf2, 0x87, 0x7c, 0x57, 0x7c, 0xbd, 0x3d, 0x6c, 0x21, 0xb2, 0x1f, + 0xe5, 0x5f, 0x34, 0xdf, 0xfa, 0x37, 0x00, 0x00, 0xff, 0xff, 0x99, 0x34, 0x80, 0xba, 0xd6, 0x15, + 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1667,18 +1668,16 @@ func (m *MsgCreatePool) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } } - if m.PoolParams != nil { - { - size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + { + size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x12 + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x12 if len(m.Sender) > 0 { i -= len(m.Sender) copy(dAtA[i:], m.Sender) @@ -2546,18 +2545,16 @@ func (m *MsgUpdatePoolParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.PoolParams != nil { - { - size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) + { + size, err := m.PoolParams.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err } - i-- - dAtA[i] = 0x1a + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) } + i-- + dAtA[i] = 0x1a if m.PoolId != 0 { i = encodeVarintTx(dAtA, i, uint64(m.PoolId)) i-- @@ -2699,10 +2696,8 @@ func (m *MsgCreatePool) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.PoolParams != nil { - l = m.PoolParams.Size() - n += 1 + l + sovTx(uint64(l)) - } + l = m.PoolParams.Size() + n += 1 + l + sovTx(uint64(l)) if len(m.PoolAssets) > 0 { for _, e := range m.PoolAssets { l = e.Size() @@ -3040,10 +3035,8 @@ func (m *MsgUpdatePoolParams) Size() (n int) { if m.PoolId != 0 { n += 1 + sovTx(uint64(m.PoolId)) } - if m.PoolParams != nil { - l = m.PoolParams.Size() - n += 1 + l + sovTx(uint64(l)) - } + l = m.PoolParams.Size() + n += 1 + l + sovTx(uint64(l)) return n } @@ -3185,9 +3178,6 @@ func (m *MsgCreatePool) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PoolParams == nil { - m.PoolParams = &PoolParams{} - } if err := m.PoolParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -5776,9 +5766,6 @@ func (m *MsgUpdatePoolParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if m.PoolParams == nil { - m.PoolParams = &PoolParams{} - } if err := m.PoolParams.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } diff --git a/x/amm/types/utils.go b/x/amm/types/utils.go index ff6024c35..5128c7db8 100644 --- a/x/amm/types/utils.go +++ b/x/amm/types/utils.go @@ -60,16 +60,16 @@ func ApplyDiscount(swapFee sdkmath.LegacyDec, discount sdkmath.LegacyDec) sdkmat return swapFee } -func GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut sdkmath.LegacyDec, poolParams PoolParams, distanceDiff sdkmath.LegacyDec) sdkmath.LegacyDec { +func GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut sdkmath.LegacyDec, distanceDiff sdkmath.LegacyDec, params Params) sdkmath.LegacyDec { weightBreakingFee := sdkmath.LegacyZeroDec() - if !weightOut.IsZero() && !weightIn.IsZero() && !targetWeightOut.IsZero() && !targetWeightIn.IsZero() && !poolParams.WeightBreakingFeeMultiplier.IsZero() { + if !weightOut.IsZero() && !weightIn.IsZero() && !targetWeightOut.IsZero() && !targetWeightIn.IsZero() && !params.WeightBreakingFeeMultiplier.IsZero() { // (45/55*60/40) ^ 2.5 if distanceDiff.IsPositive() { - weightBreakingFee = poolParams.WeightBreakingFeeMultiplier. - Mul(Pow(weightIn.Mul(targetWeightOut).Quo(weightOut).Quo(targetWeightIn), poolParams.WeightBreakingFeeExponent)) + weightBreakingFee = params.WeightBreakingFeeMultiplier. + Mul(Pow(weightIn.Mul(targetWeightOut).Quo(weightOut).Quo(targetWeightIn), params.WeightBreakingFeeExponent)) } else { - weightBreakingFee = poolParams.WeightBreakingFeeMultiplier. - Mul(Pow(weightOut.Mul(targetWeightIn).Quo(weightIn).Quo(targetWeightOut), poolParams.WeightBreakingFeeExponent)) + weightBreakingFee = params.WeightBreakingFeeMultiplier. + Mul(Pow(weightOut.Mul(targetWeightIn).Quo(weightIn).Quo(targetWeightOut), params.WeightBreakingFeeExponent)) } if weightBreakingFee.GT(sdkmath.LegacyNewDecWithPrec(99, 2)) { @@ -79,26 +79,6 @@ func GetWeightBreakingFee(weightIn, weightOut, targetWeightIn, targetWeightOut s return weightBreakingFee } -func (params PoolParams) Validate(poolWeights []PoolAsset) error { - if params.ExitFee.IsNegative() { - return ErrNegativeExitFee - } - - if params.ExitFee.GTE(sdkmath.LegacyOneDec()) { - return ErrTooMuchExitFee - } - - if params.SwapFee.IsNegative() { - return ErrNegativeSwapFee - } - - if params.SwapFee.GTE(sdkmath.LegacyOneDec()) { - return ErrTooMuchSwapFee - } - - return nil -} - // GetPoolAssetsByDenom return a mapping from pool asset // denom to the pool asset itself. There must be no duplicates. // Returns error, if any found. diff --git a/x/leveragelp/keeper/msg_server_add_pool_test.go b/x/leveragelp/keeper/msg_server_add_pool_test.go index 68ffe931d..cc61a2821 100644 --- a/x/leveragelp/keeper/msg_server_add_pool_test.go +++ b/x/leveragelp/keeper/msg_server_add_pool_test.go @@ -31,15 +31,10 @@ func initializeForAddPool(suite *KeeperTestSuite, addresses []sdk.AccAddress, as } msgCreatePool := ammtypes.MsgCreatePool{ Sender: addresses[0].String(), - PoolParams: &ammtypes.PoolParams{ - SwapFee: fee, - ExitFee: fee, - UseOracle: true, - WeightBreakingFeeMultiplier: fee, - WeightBreakingFeeExponent: fee, - WeightRecoveryFeePortion: fee, - ThresholdWeightDifference: fee, - FeeDenom: ptypes.Elys, + PoolParams: ammtypes.PoolParams{ + SwapFee: fee, + UseOracle: true, + FeeDenom: ptypes.Elys, }, PoolAssets: []ammtypes.PoolAsset{ { diff --git a/x/leveragelp/keeper/msg_server_claim_rewards_test.go b/x/leveragelp/keeper/msg_server_claim_rewards_test.go index a703be895..a997536fc 100644 --- a/x/leveragelp/keeper/msg_server_claim_rewards_test.go +++ b/x/leveragelp/keeper/msg_server_claim_rewards_test.go @@ -37,15 +37,10 @@ func initializeForClaimRewards(suite *KeeperTestSuite, addresses []sdk.AccAddres } msgCreatePool := ammtypes.MsgCreatePool{ Sender: addresses[0].String(), - PoolParams: &ammtypes.PoolParams{ - SwapFee: fee, - ExitFee: fee, - UseOracle: true, - WeightBreakingFeeMultiplier: fee, - WeightBreakingFeeExponent: fee, - WeightRecoveryFeePortion: fee, - ThresholdWeightDifference: fee, - FeeDenom: ptypes.Elys, + PoolParams: ammtypes.PoolParams{ + SwapFee: fee, + UseOracle: true, + FeeDenom: ptypes.Elys, }, PoolAssets: []ammtypes.PoolAsset{ { diff --git a/x/leveragelp/keeper/msg_server_close_test.go b/x/leveragelp/keeper/msg_server_close_test.go index 76b65b2d1..abfbaacc3 100644 --- a/x/leveragelp/keeper/msg_server_close_test.go +++ b/x/leveragelp/keeper/msg_server_close_test.go @@ -38,15 +38,10 @@ func initializeForClose(suite *KeeperTestSuite, addresses []sdk.AccAddress, asse } msgCreatePool := ammtypes.MsgCreatePool{ Sender: addresses[0].String(), - PoolParams: &ammtypes.PoolParams{ - SwapFee: fee, - ExitFee: fee, - UseOracle: true, - WeightBreakingFeeMultiplier: fee, - WeightBreakingFeeExponent: fee, - WeightRecoveryFeePortion: fee, - ThresholdWeightDifference: fee, - FeeDenom: ptypes.Elys, + PoolParams: ammtypes.PoolParams{ + SwapFee: fee, + UseOracle: true, + FeeDenom: ptypes.Elys, }, PoolAssets: []ammtypes.PoolAsset{ { diff --git a/x/leveragelp/keeper/msg_server_open_test.go b/x/leveragelp/keeper/msg_server_open_test.go index ef2aa6e4e..58ebc5b4a 100644 --- a/x/leveragelp/keeper/msg_server_open_test.go +++ b/x/leveragelp/keeper/msg_server_open_test.go @@ -36,15 +36,10 @@ func initializeForOpen(suite *KeeperTestSuite, addresses []sdk.AccAddress, asset } msgCreatePool := ammtypes.MsgCreatePool{ Sender: addresses[0].String(), - PoolParams: &ammtypes.PoolParams{ - SwapFee: fee, - ExitFee: fee, - UseOracle: true, - WeightBreakingFeeMultiplier: fee, - WeightBreakingFeeExponent: fee, - WeightRecoveryFeePortion: fee, - ThresholdWeightDifference: fee, - FeeDenom: ptypes.Elys, + PoolParams: ammtypes.PoolParams{ + SwapFee: fee, + UseOracle: true, + FeeDenom: ptypes.Elys, }, PoolAssets: []ammtypes.PoolAsset{ { diff --git a/x/leveragelp/keeper/msg_server_update_stop_loss_test.go b/x/leveragelp/keeper/msg_server_update_stop_loss_test.go index bd0f6fda6..7441f2ac2 100644 --- a/x/leveragelp/keeper/msg_server_update_stop_loss_test.go +++ b/x/leveragelp/keeper/msg_server_update_stop_loss_test.go @@ -35,15 +35,10 @@ func initializeForUpdateStopLoss(suite *KeeperTestSuite, addresses []sdk.AccAddr } msgCreatePool := ammtypes.MsgCreatePool{ Sender: addresses[0].String(), - PoolParams: &ammtypes.PoolParams{ - SwapFee: fee, - ExitFee: fee, - UseOracle: true, - WeightBreakingFeeMultiplier: fee, - WeightBreakingFeeExponent: fee, - WeightRecoveryFeePortion: fee, - ThresholdWeightDifference: fee, - FeeDenom: ptypes.Elys, + PoolParams: ammtypes.PoolParams{ + SwapFee: fee, + UseOracle: true, + FeeDenom: ptypes.Elys, }, PoolAssets: []ammtypes.PoolAsset{ { diff --git a/x/leveragelp/keeper/position.go b/x/leveragelp/keeper/position.go index 23fa8a266..24ecbe91d 100644 --- a/x/leveragelp/keeper/position.go +++ b/x/leveragelp/keeper/position.go @@ -266,12 +266,12 @@ func (k Keeper) GetPositionHealth(ctx sdk.Context, position types.Position) (sdk leveragedLpAmount = leveragedLpAmount.Add(commitment.Amount) } - exitCoinsAfterFee, _, err := k.amm.ExitPoolEst(ctx, position.GetAmmPoolId(), leveragedLpAmount, baseCurrency) + exitCoins, _, err := k.amm.ExitPoolEst(ctx, position.GetAmmPoolId(), leveragedLpAmount, baseCurrency) if err != nil { return sdkmath.LegacyZeroDec(), err } - exitAmountAfterFee := exitCoinsAfterFee.AmountOf(baseCurrency) + exitAmountAfterFee := exitCoins.AmountOf(baseCurrency) health := exitAmountAfterFee.ToLegacyDec().Quo(debtAmount.ToLegacyDec()) diff --git a/x/leveragelp/keeper/position_close.go b/x/leveragelp/keeper/position_close.go index 22ea4d9cf..7a06c63cc 100644 --- a/x/leveragelp/keeper/position_close.go +++ b/x/leveragelp/keeper/position_close.go @@ -13,7 +13,7 @@ func (k Keeper) ForceCloseLong(ctx sdk.Context, position types.Position, pool ty } // Exit liquidity with collateral token - _, exitCoinsAfterExitFee, err := k.amm.ExitPool(ctx, position.GetPositionAddress(), position.AmmPoolId, lpAmount, sdk.Coins{}, position.Collateral.Denom, isLiquidation) + exitCoins, err := k.amm.ExitPool(ctx, position.GetPositionAddress(), position.AmmPoolId, lpAmount, sdk.Coins{}, position.Collateral.Denom, isLiquidation) if err != nil { return math.ZeroInt(), err } @@ -38,7 +38,7 @@ func (k Keeper) ForceCloseLong(ctx sdk.Context, position types.Position, pool ty if bal.Amount.LT(repayAmount) { repayAmount = bal.Amount } else { - userAmount = exitCoinsAfterExitFee[0].Amount.Sub(repayAmount) + userAmount = exitCoins[0].Amount.Sub(repayAmount) } if repayAmount.IsPositive() { diff --git a/x/leveragelp/keeper/position_close_test.go b/x/leveragelp/keeper/position_close_test.go index b20c878ff..775d006f8 100644 --- a/x/leveragelp/keeper/position_close_test.go +++ b/x/leveragelp/keeper/position_close_test.go @@ -32,29 +32,33 @@ func (suite *KeeperTestSuite) OpenPosition(addr sdk.AccAddress) (*types.Position err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, poolAddr, poolInit) suite.Require().NoError(err) + ammParams := suite.app.AmmKeeper.GetParams(suite.ctx) + ammParams.WeightBreakingFeeMultiplier = math.LegacyZeroDec() + ammParams.WeightBreakingFeeExponent = math.LegacyNewDecWithPrec(25, 1) // 2.5 + ammParams.WeightRecoveryFeePortion = math.LegacyNewDecWithPrec(10, 2) // 10% + ammParams.ThresholdWeightDifference = math.LegacyZeroDec() + suite.app.AmmKeeper.SetParams(suite.ctx, ammParams) + suite.app.AmmKeeper.SetPool(suite.ctx, ammtypes.Pool{ PoolId: 1, Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: ammtypes.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - FeeDenom: "uusdc", + SwapFee: math.LegacyZeroDec(), + UseOracle: true, + FeeDenom: "uusdc", }, TotalShares: sdk.NewCoin("amm/pool/1", math.NewInt(2).Mul(ammtypes.OneShare)), PoolAssets: []ammtypes.PoolAsset{ { - Token: poolInit[0], - Weight: math.NewInt(10), + Token: poolInit[0], + Weight: math.NewInt(10), + ExternalLiquidityRatio: math.LegacyOneDec(), }, { - Token: poolInit[1], - Weight: math.NewInt(10), + Token: poolInit[1], + Weight: math.NewInt(10), + ExternalLiquidityRatio: math.LegacyOneDec(), }, }, TotalWeight: math.NewInt(20), diff --git a/x/leveragelp/keeper/position_open_test.go b/x/leveragelp/keeper/position_open_test.go index 7b07402a7..bf860dbac 100644 --- a/x/leveragelp/keeper/position_open_test.go +++ b/x/leveragelp/keeper/position_open_test.go @@ -27,19 +27,21 @@ func (suite *KeeperTestSuite) TestOpenLong() { err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, poolAddr, poolInit) suite.Require().NoError(err) + ammParams := suite.app.AmmKeeper.GetParams(suite.ctx) + ammParams.WeightBreakingFeeMultiplier = math.LegacyZeroDec() + ammParams.WeightBreakingFeeExponent = math.LegacyNewDecWithPrec(25, 1) // 2.5 + ammParams.WeightRecoveryFeePortion = math.LegacyNewDecWithPrec(10, 2) // 10% + ammParams.ThresholdWeightDifference = math.LegacyZeroDec() + suite.app.AmmKeeper.SetParams(suite.ctx, ammParams) + suite.app.AmmKeeper.SetPool(suite.ctx, ammtypes.Pool{ PoolId: 1, Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: ammtypes.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: "uusdc", + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: true, + FeeDenom: "uusdc", }, TotalShares: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(2).Mul(ammtypes.OneShare)), PoolAssets: []ammtypes.PoolAsset{ diff --git a/x/leveragelp/keeper/query_estimation_test.go b/x/leveragelp/keeper/query_estimation_test.go index 26da0f149..91c832cbb 100644 --- a/x/leveragelp/keeper/query_estimation_test.go +++ b/x/leveragelp/keeper/query_estimation_test.go @@ -39,14 +39,9 @@ func (suite *KeeperTestSuite) TestQueryEstimation() { Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: ammtypes.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: "uusdc", + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: true, + FeeDenom: "uusdc", }, TotalShares: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(2).Mul(ammtypes.OneShare)), PoolAssets: []ammtypes.PoolAsset{ diff --git a/x/leveragelp/keeper/query_get_position_test.go b/x/leveragelp/keeper/query_get_position_test.go index c3ec56a6e..66982f7a7 100644 --- a/x/leveragelp/keeper/query_get_position_test.go +++ b/x/leveragelp/keeper/query_get_position_test.go @@ -33,19 +33,21 @@ func (suite *KeeperTestSuite) TestQueryGetPosition() { err = suite.app.BankKeeper.SendCoinsFromModuleToAccount(suite.ctx, minttypes.ModuleName, poolAddr, poolInit) suite.Require().NoError(err) + ammParams := suite.app.AmmKeeper.GetParams(suite.ctx) + ammParams.WeightBreakingFeeMultiplier = sdkmath.LegacyZeroDec() + ammParams.WeightBreakingFeeExponent = sdkmath.LegacyNewDecWithPrec(25, 1) // 2.5 + ammParams.WeightRecoveryFeePortion = sdkmath.LegacyNewDecWithPrec(10, 2) // 10% + ammParams.ThresholdWeightDifference = sdkmath.LegacyZeroDec() + suite.app.AmmKeeper.SetParams(suite.ctx, ammParams) + suite.app.AmmKeeper.SetPool(suite.ctx, ammtypes.Pool{ PoolId: 1, Address: poolAddr.String(), RebalanceTreasury: treasuryAddr.String(), PoolParams: ammtypes.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: "uusdc", + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: true, + FeeDenom: "uusdc", }, TotalShares: sdk.NewCoin("amm/pool/1", sdkmath.NewInt(2).Mul(ammtypes.OneShare)), PoolAssets: []ammtypes.PoolAsset{ diff --git a/x/leveragelp/keeper/utils.go b/x/leveragelp/keeper/utils.go index fc2db9fa1..f593f366a 100644 --- a/x/leveragelp/keeper/utils.go +++ b/x/leveragelp/keeper/utils.go @@ -75,12 +75,12 @@ func (k Keeper) GetLeverageLpUpdatedLeverage(ctx sdk.Context, positions []*types if !found { return nil, errorsmod.Wrapf(assetprofiletypes.ErrAssetProfileNotFound, "asset %s not found", ptypes.BaseCurrency) } - exitCoinsAfterFee, _, err := k.amm.ExitPoolEst(ctx, position.GetAmmPoolId(), position.LeveragedLpAmount, baseCurrency) + exitCoins, _, err := k.amm.ExitPoolEst(ctx, position.GetAmmPoolId(), position.LeveragedLpAmount, baseCurrency) if err != nil { return nil, err } - exitAmountAfterFee := exitCoinsAfterFee.AmountOf(baseCurrency) + exitAmountAfterFee := exitCoins.AmountOf(baseCurrency) updated_leverage := sdkmath.LegacyZeroDec() denomimator := exitAmountAfterFee.ToLegacyDec().Sub(position.Liabilities.ToLegacyDec()) diff --git a/x/leveragelp/types/expected_keepers.go b/x/leveragelp/types/expected_keepers.go index d1b14c40f..e2d064d8b 100644 --- a/x/leveragelp/types/expected_keepers.go +++ b/x/leveragelp/types/expected_keepers.go @@ -31,7 +31,7 @@ type AmmKeeper interface { CalcOutAmtGivenIn(ctx sdk.Context, poolId uint64, oracle ammtypes.OracleKeeper, snapshot *ammtypes.Pool, tokensIn sdk.Coins, tokenOutDenom string, swapFee sdkmath.LegacyDec) (sdk.Coin, sdkmath.LegacyDec, error) CalcInAmtGivenOut(ctx sdk.Context, poolId uint64, oracle ammtypes.OracleKeeper, snapshot *ammtypes.Pool, tokensOut sdk.Coins, tokenInDenom string, swapFee sdkmath.LegacyDec) (tokenIn sdk.Coin, slippage sdkmath.LegacyDec, err error) JoinPoolNoSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareOutAmount sdkmath.Int, tokenInMaxs sdk.Coins) (tokenIn sdk.Coins, sharesOut sdkmath.Int, err error) - ExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount sdkmath.Int, tokenOutMins sdk.Coins, tokenOutDenom string, isLiquidation bool) (exitCoins, exitCoinsAfterExitFee sdk.Coins, err error) + ExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount sdkmath.Int, tokenOutMins sdk.Coins, tokenOutDenom string, isLiquidation bool) (exitCoins sdk.Coins, err error) } // BankKeeper defines the expected interface needed to retrieve account balances. diff --git a/x/masterchef/keeper/abci_test.go b/x/masterchef/keeper/abci_test.go index 28d20383b..1d336194f 100644 --- a/x/masterchef/keeper/abci_test.go +++ b/x/masterchef/keeper/abci_test.go @@ -133,16 +133,14 @@ func (suite *MasterchefKeeperTestSuite) TestCollectGasFees() { }, } - argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.1") - argExitFee := sdkmath.LegacyMustNewDecFromStr("0.1") + argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.01") - poolParams := &ammtypes.PoolParams{ + poolParams := ammtypes.PoolParams{ SwapFee: argSwapFee, - ExitFee: argExitFee, } // Create a Elys+USDC pool - ammPool := suite.CreateNewAmmPool(sdk.AccAddress(addr[0]), poolAssets, poolParams) + ammPool := suite.CreateNewAmmPool(addr[0], poolAssets, poolParams) suite.Require().Equal(ammPool.PoolId, uint64(1)) pools := suite.app.AmmKeeper.GetAllPool(suite.ctx) @@ -187,12 +185,10 @@ func (suite *MasterchefKeeperTestSuite) TestCollectDEXRevenue() { }, } - argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.1") - argExitFee := sdkmath.LegacyMustNewDecFromStr("0.1") + argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.01") - poolParams := &ammtypes.PoolParams{ + poolParams := ammtypes.PoolParams{ SwapFee: argSwapFee, - ExitFee: argExitFee, } // Create a Elys+USDC pool @@ -295,12 +291,10 @@ func (suite *MasterchefKeeperTestSuite) TestExternalRewardsDistribution() { }, } - argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.1") - argExitFee := sdkmath.LegacyMustNewDecFromStr("0.1") + argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.01") - poolParams := &ammtypes.PoolParams{ + poolParams := ammtypes.PoolParams{ SwapFee: argSwapFee, - ExitFee: argExitFee, } // Create a Elys+USDC pool diff --git a/x/masterchef/keeper/apr_pool_test.go b/x/masterchef/keeper/apr_pool_test.go index 811e30752..9fb2a1d97 100644 --- a/x/masterchef/keeper/apr_pool_test.go +++ b/x/masterchef/keeper/apr_pool_test.go @@ -2,9 +2,10 @@ package keeper_test import ( sdkmath "cosmossdk.io/math" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" sdk "github.com/cosmos/cosmos-sdk/types" - simapp "github.com/elys-network/elys/app" ammtypes "github.com/elys-network/elys/x/amm/types" ptypes "github.com/elys-network/elys/x/parameter/types" ) @@ -12,11 +13,11 @@ import ( func (suite *MasterchefKeeperTestSuite) TestCalculatePoolAprs() { // Generate 1 random account with 1000stake balanced - addr := simapp.AddTestAddrs(suite.app, suite.ctx, 1, sdkmath.NewInt(100010)) + addr := authtypes.NewModuleAddress(govtypes.ModuleName) // Mint 100000USDC + 10 ELYS (pool creation fee) - coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) - suite.MintMultipleTokenToAddress(addr[0], coins) + coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 110000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) + suite.MintMultipleTokenToAddress(addr, coins) // Create pool var poolAssets []ammtypes.PoolAsset @@ -32,18 +33,13 @@ func (suite *MasterchefKeeperTestSuite) TestCalculatePoolAprs() { Token: sdk.NewCoin(ptypes.BaseCurrency, sdkmath.NewInt(100)), }) - poolParams := &ammtypes.PoolParams{ - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - FeeDenom: "", + poolParams := ammtypes.PoolParams{ + SwapFee: sdkmath.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, } // Create a Elys+USDC pool - ammPool := suite.CreateNewAmmPool(addr[0], poolAssets, poolParams) + ammPool := suite.CreateNewAmmPool(addr, poolAssets, poolParams) suite.Require().Equal(ammPool.PoolId, uint64(1)) poolInfo, found := suite.app.MasterchefKeeper.GetPoolInfo(suite.ctx, ammPool.PoolId) diff --git a/x/masterchef/keeper/external_incentive_test.go b/x/masterchef/keeper/external_incentive_test.go index 8b91b60e5..483bf6a63 100644 --- a/x/masterchef/keeper/external_incentive_test.go +++ b/x/masterchef/keeper/external_incentive_test.go @@ -126,11 +126,9 @@ func (suite *MasterchefKeeperTestSuite) TestUSDCExternalIncentive() { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - poolParams := &ammtypes.PoolParams{ + poolParams := ammtypes.PoolParams{ SwapFee: argSwapFee, - ExitFee: argExitFee, } // Create a Elys+USDC pool @@ -142,7 +140,7 @@ func (suite *MasterchefKeeperTestSuite) TestUSDCExternalIncentive() { // check length of pools suite.Require().Equal(len(pools), 1) - _, _, err = suite.app.AmmKeeper.ExitPool(suite.ctx, addr[0], pools[0].PoolId, math.NewIntWithDecimal(1, 21), sdk.NewCoins(), "", false) + _, err = suite.app.AmmKeeper.ExitPool(suite.ctx, addr[0], pools[0].PoolId, math.NewIntWithDecimal(1, 21), sdk.NewCoins(), "", false) suite.Require().NoError(err) // new user join pool with same shares diff --git a/x/masterchef/keeper/hooks_masterchef_test.go b/x/masterchef/keeper/hooks_masterchef_test.go index 66014157e..2d18fd682 100644 --- a/x/masterchef/keeper/hooks_masterchef_test.go +++ b/x/masterchef/keeper/hooks_masterchef_test.go @@ -77,11 +77,9 @@ func (suite *MasterchefKeeperTestSuite) TestHookMasterchef() { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - poolParams := &ammtypes.PoolParams{ + poolParams := ammtypes.PoolParams{ SwapFee: argSwapFee, - ExitFee: argExitFee, } // Create a Elys+USDC pool @@ -93,7 +91,7 @@ func (suite *MasterchefKeeperTestSuite) TestHookMasterchef() { // check length of pools suite.Require().Equal(len(pools), 1) - _, _, err = suite.app.AmmKeeper.ExitPool(suite.ctx, addr[0], pools[0].PoolId, math.NewIntWithDecimal(1, 21), sdk.NewCoins(), "", false) + _, err = suite.app.AmmKeeper.ExitPool(suite.ctx, addr[0], pools[0].PoolId, math.NewIntWithDecimal(1, 21), sdk.NewCoins(), "", false) suite.Require().NoError(err) // new user join pool with same shares @@ -177,7 +175,7 @@ func (suite *MasterchefKeeperTestSuite) TestHookMasterchef() { suite.Require().Len(res.TotalRewards, 0) // first user exit pool - _, _, err = suite.app.AmmKeeper.ExitPool(ctx, addr[1], pools[0].PoolId, share.Quo(math.NewInt(2)), sdk.NewCoins(), "", false) + _, err = suite.app.AmmKeeper.ExitPool(ctx, addr[1], pools[0].PoolId, share.Quo(math.NewInt(2)), sdk.NewCoins(), "", false) suite.Require().NoError(err) // check rewards after 100 block diff --git a/x/masterchef/keeper/keeper_test.go b/x/masterchef/keeper/keeper_test.go index 4f3fadad5..161fffee4 100644 --- a/x/masterchef/keeper/keeper_test.go +++ b/x/masterchef/keeper/keeper_test.go @@ -147,7 +147,7 @@ func (suite *MasterchefKeeperTestSuite) SetupStableCoinPrices() { }) } -func (suite *MasterchefKeeperTestSuite) CreateNewAmmPool(creator sdk.AccAddress, poolAssets []ammtypes.PoolAsset, poolParams *ammtypes.PoolParams) ammtypes.Pool { +func (suite *MasterchefKeeperTestSuite) CreateNewAmmPool(creator sdk.AccAddress, poolAssets []ammtypes.PoolAsset, poolParams ammtypes.PoolParams) ammtypes.Pool { createPoolMsg := &ammtypes.MsgCreatePool{ Sender: creator.String(), diff --git a/x/masterchef/keeper/query_test.go b/x/masterchef/keeper/query_test.go index 7d97c1500..c6f2285c7 100644 --- a/x/masterchef/keeper/query_test.go +++ b/x/masterchef/keeper/query_test.go @@ -4,6 +4,8 @@ import ( "cosmossdk.io/math" sdkmath "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" simapp "github.com/elys-network/elys/app" ammtypes "github.com/elys-network/elys/x/amm/types" estakingtypes "github.com/elys-network/elys/x/estaking/types" @@ -16,12 +18,12 @@ import ( func (suite *MasterchefKeeperTestSuite) SetupApp() { // Generate 1 random account with 1000stake balanced - addr := simapp.AddTestAddrs(suite.app, suite.ctx, 1, math.NewInt(100010)) + addr := authtypes.NewModuleAddress(govtypes.ModuleName) // Create a pool // Mint 100000USDC + 10 ELYS (pool creation fee) - coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) - suite.MintMultipleTokenToAddress(addr[0], coins) + coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 110000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) + suite.MintMultipleTokenToAddress(addr, coins) //app.StakingKeeper.Delegate(ctx, addr[0], math.NewInt(100000), sdk.Unbonded, sdk.NewDec(0.1), math.NewInt(100000)) @@ -38,19 +40,14 @@ func (suite *MasterchefKeeperTestSuite) SetupApp() { Token: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(100)), }) - poolParams := &ammtypes.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - FeeDenom: "", + poolParams := ammtypes.PoolParams{ + SwapFee: math.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, } // Create a Elys+USDC pool - ammPool := suite.CreateNewAmmPool(addr[0], poolAssets, poolParams) + ammPool := suite.CreateNewAmmPool(addr, poolAssets, poolParams) suite.Require().Equal(ammPool.PoolId, uint64(1)) poolInfo, found := suite.app.MasterchefKeeper.GetPoolInfo(suite.ctx, ammPool.PoolId) diff --git a/x/perpetual/keeper/close_test.go b/x/perpetual/keeper/close_test.go index 1129e26c7..14c12e1e4 100644 --- a/x/perpetual/keeper/close_test.go +++ b/x/perpetual/keeper/close_test.go @@ -93,7 +93,7 @@ func (suite *PerpetualKeeperTestSuite) TestClose() { } }, "", - math.NewInt(200), + math.NewInt(202), }, { "Close with price greater than open price and less than take profit price", @@ -130,11 +130,11 @@ func (suite *PerpetualKeeperTestSuite) TestClose() { return &types.MsgClose{ Creator: positionCreator.String(), Id: position.Id, - Amount: math.NewInt(399), + Amount: math.NewInt(107), } }, "", - math.NewInt(100), // less than at the same price + math.NewInt(29), // less than at the same price }, { "Close at take profit price", @@ -175,7 +175,7 @@ func (suite *PerpetualKeeperTestSuite) TestClose() { } }, "", - math.NewInt(50), + math.NewInt(72), }, { "Close at stopLoss price", @@ -216,7 +216,7 @@ func (suite *PerpetualKeeperTestSuite) TestClose() { } }, "", - math.NewInt(500), + math.NewInt(501), }, { "Sucess: close long position,at same price as open price", @@ -247,7 +247,7 @@ func (suite *PerpetualKeeperTestSuite) TestClose() { } }, "", - math.NewInt(200), + math.NewInt(202), }, { "Success: close short position at same price as open price", diff --git a/x/perpetual/keeper/get_amm_pool_test.go b/x/perpetual/keeper/get_amm_pool_test.go index 5c3c9f0d0..eebae02b6 100644 --- a/x/perpetual/keeper/get_amm_pool_test.go +++ b/x/perpetual/keeper/get_amm_pool_test.go @@ -14,15 +14,9 @@ func (suite *PerpetualKeeperTestSuite) TestGetAmmPool() { Address: ammtypes.NewPoolAddress(1).String(), RebalanceTreasury: "", PoolParams: ammtypes.PoolParams{ - UseOracle: false, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - WeightBreakingFeePortion: sdkmath.LegacyNewDecWithPrec(50, 2), // 50% - SwapFee: sdkmath.LegacyZeroDec(), - ExitFee: sdkmath.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + UseOracle: false, + SwapFee: sdkmath.LegacyZeroDec(), + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.NewCoin("pool/1", sdkmath.NewInt(100)), PoolAssets: []ammtypes.PoolAsset{ diff --git a/x/perpetual/keeper/keeper_test.go b/x/perpetual/keeper/keeper_test.go index 58b0bcb82..a4c7a81ab 100644 --- a/x/perpetual/keeper/keeper_test.go +++ b/x/perpetual/keeper/keeper_test.go @@ -209,19 +209,14 @@ func (suite *PerpetualKeeperTestSuite) CreateNewAmmPool(creator sdk.AccAddress, return strings.Compare(poolAssets[i].Token.Denom, poolAssets[j].Token.Denom) <= 0 }) poolParams := ammtypes.PoolParams{ - UseOracle: useOracle, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: swapFee, - ExitFee: exitFee, - FeeDenom: ptypes.BaseCurrency, + UseOracle: useOracle, + SwapFee: swapFee, + FeeDenom: ptypes.BaseCurrency, } createPoolMsg := &ammtypes.MsgCreatePool{ Sender: creator.String(), - PoolParams: &poolParams, + PoolParams: poolParams, PoolAssets: poolAssets, } diff --git a/x/perpetual/keeper/open_consolidate_test.go b/x/perpetual/keeper/open_consolidate_test.go index 7b94ac906..599ea926c 100644 --- a/x/perpetual/keeper/open_consolidate_test.go +++ b/x/perpetual/keeper/open_consolidate_test.go @@ -172,7 +172,7 @@ func (suite *PerpetualKeeperTestSuite) TestOpenConsolidateUsingOpen() { "", &types.MTP{ Collateral: math.NewInt(800), - Liabilities: math.NewInt(641), + Liabilities: math.NewInt(649), Custody: math.NewInt(4000), TakeProfitPrice: math.LegacyMustNewDecFromStr("0.692857142857142857"), }, @@ -211,7 +211,7 @@ func (suite *PerpetualKeeperTestSuite) TestOpenConsolidateUsingOpen() { "", &types.MTP{ Collateral: math.NewInt(800), - Liabilities: math.NewInt(400), + Liabilities: math.NewInt(405), Custody: math.NewInt(2800), TakeProfitPrice: math.LegacyMustNewDecFromStr("0.95"), }, diff --git a/x/perpetual/keeper/pool_test.go b/x/perpetual/keeper/pool_test.go index c27ec6866..951705adb 100644 --- a/x/perpetual/keeper/pool_test.go +++ b/x/perpetual/keeper/pool_test.go @@ -34,14 +34,9 @@ func createNPool(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.Pool { Address: ammtypes.NewPoolAddress(poolId).String(), RebalanceTreasury: ammtypes.NewPoolRebalanceTreasury(poolId).String(), PoolParams: ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - FeeDenom: ptypes.BaseCurrency, + UseOracle: true, + SwapFee: math.LegacyZeroDec(), + FeeDenom: ptypes.BaseCurrency, }, TotalShares: sdk.NewCoin("pool/1", math.NewInt(100)), PoolAssets: poolAssets, diff --git a/x/perpetual/keeper/process_mtp_test.go b/x/perpetual/keeper/process_mtp_test.go index 39f0a115f..eb4655f03 100644 --- a/x/perpetual/keeper/process_mtp_test.go +++ b/x/perpetual/keeper/process_mtp_test.go @@ -71,17 +71,11 @@ func (suite *PerpetualKeeperTestSuite) TestCheckAndLiquidateUnhealthyPosition() } argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.0") - argExitFee := sdkmath.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -255,17 +249,11 @@ func TestCheckAndCloseAtTakeProfit(t *testing.T) { } argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.0") - argExitFee := sdkmath.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -392,6 +380,8 @@ func (suite *PerpetualKeeperTestSuite) TestCheckAndLiquidateStopLossPosition() { // Mint 100000ATOM atomToken := []sdk.Coin{sdk.NewCoin(ptypes.ATOM, sdkmath.NewInt(200000000000))} + elysToken := []sdk.Coin{sdk.NewCoin(ptypes.Elys, sdkmath.NewInt(200000000000))} + err := app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, usdcToken) suite.Require().NoError(err) err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], usdcToken) @@ -402,6 +392,11 @@ func (suite *PerpetualKeeperTestSuite) TestCheckAndLiquidateStopLossPosition() { err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], atomToken) suite.Require().NoError(err) + err = app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, elysToken) + suite.Require().NoError(err) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], elysToken) + suite.Require().NoError(err) + poolAssets := []ammtypes.PoolAsset{ { Weight: sdkmath.NewInt(50), @@ -416,17 +411,11 @@ func (suite *PerpetualKeeperTestSuite) TestCheckAndLiquidateStopLossPosition() { } argSwapFee := sdkmath.LegacyMustNewDecFromStr("0.0") - argExitFee := sdkmath.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: sdkmath.LegacyZeroDec(), - WeightBreakingFeeExponent: sdkmath.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: sdkmath.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: sdkmath.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -454,7 +443,7 @@ func (suite *PerpetualKeeperTestSuite) TestCheckAndLiquidateStopLossPosition() { poolAddress := sdk.MustAccAddressFromBech32(ammPool.GetAddress()) suite.Require().NoError(err) - err = app.BankKeeper.SendCoins(ctx, addr[0], poolAddress, sdk.NewCoins(sdk.NewCoin("uelys", sdkmath.NewInt(1000000)))) + err = app.BankKeeper.SendCoins(ctx, addr[0], poolAddress, sdk.NewCoins(sdk.NewCoin(ptypes.Elys, sdkmath.NewInt(1000000)))) suite.Require().NoError(err) // Balance check before create a perpetual position balances := app.BankKeeper.GetAllBalances(ctx, poolAddress) diff --git a/x/perpetual/keeper/query_open_estimation_test.go b/x/perpetual/keeper/query_open_estimation_test.go index 671acd42b..38e1e076e 100644 --- a/x/perpetual/keeper/query_open_estimation_test.go +++ b/x/perpetual/keeper/query_open_estimation_test.go @@ -68,17 +68,11 @@ func TestOpenEstimation_Long5XAtom100Usdc(t *testing.T) { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -199,17 +193,10 @@ func TestOpenEstimation_Long5XAtom10Atom(t *testing.T) { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -251,23 +238,23 @@ func TestOpenEstimation_Long5XAtom10Atom(t *testing.T) { require.NoError(t, err) require.Equal(t, &types.QueryOpenEstimationResponse{ Position: types.Position_LONG, - EffectiveLeverage: math.LegacyMustNewDecFromStr("5.035307678145308466"), + EffectiveLeverage: math.LegacyMustNewDecFromStr("5.064647900714587379"), TradingAsset: ptypes.ATOM, Collateral: sdk.NewCoin(ptypes.ATOM, math.NewInt(10_000_000)), PositionSize: sdk.NewCoin(ptypes.ATOM, math.NewInt(50_000_000)), - OpenPrice: math.LegacyMustNewDecFromStr("5.008765025000000000"), + OpenPrice: math.LegacyMustNewDecFromStr("5.015955675000000000"), TakeProfitPrice: tradingAssetPrice.MulInt64(3), - LiquidationPrice: math.LegacyMustNewDecFromStr("4.107187320500000000"), - EstimatedPnl: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(399649399)), + LiquidationPrice: math.LegacyMustNewDecFromStr("4.113083653500000000"), + EstimatedPnl: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(399361773)), HourlyInterestRate: math.LegacyZeroDec(), AvailableLiquidity: sdk.NewCoin(ptypes.ATOM, math.NewInt(10000000000)), Slippage: math.LegacyMustNewDecFromStr("0.000751255000000000"), BorrowInterestRate: math.LegacyMustNewDecFromStr("0.000000000000000000"), FundingRate: math.LegacyMustNewDecFromStr("0.000000000000000000"), - PriceImpact: math.LegacyMustNewDecFromStr("-0.001753005000000000"), + PriceImpact: math.LegacyMustNewDecFromStr("-0.003191135000000000"), Custody: sdk.NewCoin(ptypes.ATOM, math.NewInt(50_000_000)), - Liabilities: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(200_350_601)), - WeightBreakingFee: math.LegacyZeroDec(), + Liabilities: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(200638227)), + WeightBreakingFee: math.LegacyMustNewDecFromStr("0.001435613665417722"), }, res) } @@ -329,17 +316,11 @@ func TestOpenEstimation_Long10XAtom1000Usdc(t *testing.T) { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -474,17 +455,11 @@ func TestOpenEstimation_Short5XAtom10Usdc(t *testing.T) { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( @@ -606,17 +581,11 @@ func TestOpenEstimation_WrongAsset(t *testing.T) { } argSwapFee := math.LegacyMustNewDecFromStr("0.0") - argExitFee := math.LegacyMustNewDecFromStr("0.0") - - poolParams := &ammtypes.PoolParams{ - UseOracle: true, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - SwapFee: argSwapFee, - ExitFee: argExitFee, - FeeDenom: ptypes.BaseCurrency, + + poolParams := ammtypes.PoolParams{ + UseOracle: true, + SwapFee: argSwapFee, + FeeDenom: ptypes.BaseCurrency, } msg := ammtypes.NewMsgCreatePool( diff --git a/x/tier/keeper/portfolio_test.go b/x/tier/keeper/portfolio_test.go index 68122f794..7bdb24f20 100644 --- a/x/tier/keeper/portfolio_test.go +++ b/x/tier/keeper/portfolio_test.go @@ -1,6 +1,8 @@ package keeper_test import ( + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "strconv" "testing" @@ -127,14 +129,14 @@ func TestGetPortfolioAmm(t *testing.T) { SetupCoinPrices(ctx, oracle, assetProfiler) // Generate 1 random account with 1000stake balanced - addr := simapp.AddTestAddrs(app, ctx, 1, math.NewInt(1000000)) + sender := authtypes.NewModuleAddress(govtypes.ModuleName) // Create a pool // Mint 100000USDC + 10 ELYS (pool creation fee) - coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 10000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) + coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 100000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 100000)) err = app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, coins) require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], coins) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, sender, coins) require.NoError(t, err) var poolAssets []ammtypes.PoolAsset @@ -150,15 +152,10 @@ func TestGetPortfolioAmm(t *testing.T) { Token: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(10000)), }) - poolParams := &ammtypes.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - FeeDenom: "", + poolParams := ammtypes.PoolParams{ + SwapFee: math.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, } // Create a Elys+USDC pool @@ -166,7 +163,7 @@ func TestGetPortfolioAmm(t *testing.T) { resp, err := msgServer.CreatePool( ctx, &ammtypes.MsgCreatePool{ - Sender: addr[0].String(), + Sender: sender.String(), PoolParams: poolParams, PoolAssets: poolAssets, }) @@ -183,11 +180,11 @@ func TestGetPortfolioAmm(t *testing.T) { require.NoError(t, err) require.Equal(t, resp.PoolID, uint64(1)) - tier.RetrieveAllPortfolio(ctx, addr[0]) + tier.RetrieveAllPortfolio(ctx, sender) - portfolio, found := tier.GetPortfolio(ctx, addr[0], tier.GetDateFromContext(ctx)) + portfolio, found := tier.GetPortfolio(ctx, sender, tier.GetDateFromContext(ctx)) require.True(t, found) - require.Equal(t, math.LegacyNewDec(100100), portfolio) + require.Equal(t, math.LegacyNewDec(109000), portfolio) } func TestPortfolioGetDiscount(t *testing.T) { @@ -230,13 +227,13 @@ func TestGetPortfolioPerpetual(t *testing.T) { SetupCoinPrices(ctx, oracle, assetProfiler) // Generate 1 random account with 1000stake balanced - addr := simapp.AddTestAddrs(app, ctx, 1, math.NewInt(1000000)) + addr := authtypes.NewModuleAddress(govtypes.ModuleName) // Create a pool coins := sdk.NewCoins(sdk.NewInt64Coin(ptypes.Elys, 1000000000), sdk.NewInt64Coin(ptypes.BaseCurrency, 10000000)) err = app.BankKeeper.MintCoins(ctx, ammtypes.ModuleName, coins) require.NoError(t, err) - err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr[0], coins) + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, ammtypes.ModuleName, addr, coins) require.NoError(t, err) var poolAssets []ammtypes.PoolAsset @@ -252,15 +249,10 @@ func TestGetPortfolioPerpetual(t *testing.T) { Token: sdk.NewCoin(ptypes.BaseCurrency, math.NewInt(1000000)), }) - poolParams := &ammtypes.PoolParams{ - SwapFee: math.LegacyZeroDec(), - ExitFee: math.LegacyZeroDec(), - UseOracle: false, - WeightBreakingFeeMultiplier: math.LegacyZeroDec(), - WeightBreakingFeeExponent: math.LegacyNewDecWithPrec(25, 1), // 2.5 - WeightRecoveryFeePortion: math.LegacyNewDecWithPrec(10, 2), // 10% - ThresholdWeightDifference: math.LegacyZeroDec(), - FeeDenom: "", + poolParams := ammtypes.PoolParams{ + SwapFee: math.LegacyZeroDec(), + UseOracle: false, + FeeDenom: ptypes.BaseCurrency, } // Create a Elys+USDC pool @@ -268,7 +260,7 @@ func TestGetPortfolioPerpetual(t *testing.T) { resp, err := msgServer.CreatePool( ctx, &ammtypes.MsgCreatePool{ - Sender: addr[0].String(), + Sender: addr.String(), PoolParams: poolParams, PoolAssets: poolAssets, }) @@ -277,7 +269,7 @@ func TestGetPortfolioPerpetual(t *testing.T) { require.Equal(t, resp.PoolID, uint64(1)) err = perpetual.SetMTP(ctx, &perpetualtypes.MTP{ - Address: addr[0].String(), + Address: addr.String(), CollateralAsset: ptypes.BaseCurrency, CustodyAsset: ptypes.Elys, Collateral: math.NewInt(0), @@ -291,11 +283,11 @@ func TestGetPortfolioPerpetual(t *testing.T) { }) require.NoError(t, err) - tier.RetrieveAllPortfolio(ctx, addr[0]) + tier.RetrieveAllPortfolio(ctx, addr) - portfolio, found := tier.GetPortfolio(ctx, addr[0], tier.GetDateFromContext(ctx)) + portfolio, found := tier.GetPortfolio(ctx, addr, tier.GetDateFromContext(ctx)) require.True(t, found) - require.Equal(t, math.LegacyNewDec(10099100), portfolio) + require.Equal(t, math.LegacyNewDec(10099000), portfolio) } // TODO