From 1ad1686f5ae693cc621df7632d96437ed7742a15 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 10:10:49 +0530 Subject: [PATCH 1/8] weight break --- api/elys/amm/pool.pulsar.go | 651 +++++++++++++++++- proto/elys/amm/pool.proto | 10 + .../keeper/track_weight_breaking_slippage.go | 64 ++ x/amm/types/keys.go | 7 + x/amm/types/pool.pb.go | 331 ++++++++- 5 files changed, 1002 insertions(+), 61 deletions(-) create mode 100644 x/amm/keeper/track_weight_breaking_slippage.go diff --git a/api/elys/amm/pool.pulsar.go b/api/elys/amm/pool.pulsar.go index 646f2b598..572d6c18c 100644 --- a/api/elys/amm/pool.pulsar.go +++ b/api/elys/amm/pool.pulsar.go @@ -2873,6 +2873,538 @@ func (x *fastReflection_OraclePoolSlippageTrack) ProtoMethods() *protoiface.Meth } } +var ( + md_WeightBreakingSlippage protoreflect.MessageDescriptor + fd_WeightBreakingSlippage_pool_id protoreflect.FieldDescriptor + fd_WeightBreakingSlippage_date protoreflect.FieldDescriptor + fd_WeightBreakingSlippage_amount protoreflect.FieldDescriptor +) + +func init() { + file_elys_amm_pool_proto_init() + md_WeightBreakingSlippage = File_elys_amm_pool_proto.Messages().ByName("WeightBreakingSlippage") + fd_WeightBreakingSlippage_pool_id = md_WeightBreakingSlippage.Fields().ByName("pool_id") + fd_WeightBreakingSlippage_date = md_WeightBreakingSlippage.Fields().ByName("date") + fd_WeightBreakingSlippage_amount = md_WeightBreakingSlippage.Fields().ByName("amount") +} + +var _ protoreflect.Message = (*fastReflection_WeightBreakingSlippage)(nil) + +type fastReflection_WeightBreakingSlippage WeightBreakingSlippage + +func (x *WeightBreakingSlippage) ProtoReflect() protoreflect.Message { + return (*fastReflection_WeightBreakingSlippage)(x) +} + +func (x *WeightBreakingSlippage) slowProtoReflect() protoreflect.Message { + mi := &file_elys_amm_pool_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +var _fastReflection_WeightBreakingSlippage_messageType fastReflection_WeightBreakingSlippage_messageType +var _ protoreflect.MessageType = fastReflection_WeightBreakingSlippage_messageType{} + +type fastReflection_WeightBreakingSlippage_messageType struct{} + +func (x fastReflection_WeightBreakingSlippage_messageType) Zero() protoreflect.Message { + return (*fastReflection_WeightBreakingSlippage)(nil) +} +func (x fastReflection_WeightBreakingSlippage_messageType) New() protoreflect.Message { + return new(fastReflection_WeightBreakingSlippage) +} +func (x fastReflection_WeightBreakingSlippage_messageType) Descriptor() protoreflect.MessageDescriptor { + return md_WeightBreakingSlippage +} + +// Descriptor returns message descriptor, which contains only the protobuf +// type information for the message. +func (x *fastReflection_WeightBreakingSlippage) Descriptor() protoreflect.MessageDescriptor { + return md_WeightBreakingSlippage +} + +// 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_WeightBreakingSlippage) Type() protoreflect.MessageType { + return _fastReflection_WeightBreakingSlippage_messageType +} + +// New returns a newly allocated and mutable empty message. +func (x *fastReflection_WeightBreakingSlippage) New() protoreflect.Message { + return new(fastReflection_WeightBreakingSlippage) +} + +// Interface unwraps the message reflection interface and +// returns the underlying ProtoMessage interface. +func (x *fastReflection_WeightBreakingSlippage) Interface() protoreflect.ProtoMessage { + return (*WeightBreakingSlippage)(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_WeightBreakingSlippage) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) { + if x.PoolId != uint64(0) { + value := protoreflect.ValueOfUint64(x.PoolId) + if !f(fd_WeightBreakingSlippage_pool_id, value) { + return + } + } + if x.Date != "" { + value := protoreflect.ValueOfString(x.Date) + if !f(fd_WeightBreakingSlippage_date, value) { + return + } + } + if x.Amount != "" { + value := protoreflect.ValueOfString(x.Amount) + if !f(fd_WeightBreakingSlippage_amount, value) { + return + } + } +} + +// Has reports whether a field is populated. +// +// Some fields have the property of nullability where it is possible to +// distinguish between the default value of a field and whether the field +// was explicitly populated with the default value. Singular message fields, +// member fields of a oneof, and proto2 scalar fields are nullable. Such +// fields are populated only if explicitly set. +// +// In other cases (aside from the nullable cases above), +// a proto3 scalar field is populated if it contains a non-zero value, and +// a repeated field is populated if it is non-empty. +func (x *fastReflection_WeightBreakingSlippage) Has(fd protoreflect.FieldDescriptor) bool { + switch fd.FullName() { + case "elys.amm.WeightBreakingSlippage.pool_id": + return x.PoolId != uint64(0) + case "elys.amm.WeightBreakingSlippage.date": + return x.Date != "" + case "elys.amm.WeightBreakingSlippage.amount": + return x.Amount != "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.WeightBreakingSlippage")) + } + panic(fmt.Errorf("message elys.amm.WeightBreakingSlippage 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_WeightBreakingSlippage) Clear(fd protoreflect.FieldDescriptor) { + switch fd.FullName() { + case "elys.amm.WeightBreakingSlippage.pool_id": + x.PoolId = uint64(0) + case "elys.amm.WeightBreakingSlippage.date": + x.Date = "" + case "elys.amm.WeightBreakingSlippage.amount": + x.Amount = "" + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.WeightBreakingSlippage")) + } + panic(fmt.Errorf("message elys.amm.WeightBreakingSlippage 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_WeightBreakingSlippage) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value { + switch descriptor.FullName() { + case "elys.amm.WeightBreakingSlippage.pool_id": + value := x.PoolId + return protoreflect.ValueOfUint64(value) + case "elys.amm.WeightBreakingSlippage.date": + value := x.Date + return protoreflect.ValueOfString(value) + case "elys.amm.WeightBreakingSlippage.amount": + value := x.Amount + return protoreflect.ValueOfString(value) + default: + if descriptor.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.WeightBreakingSlippage")) + } + panic(fmt.Errorf("message elys.amm.WeightBreakingSlippage 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_WeightBreakingSlippage) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) { + switch fd.FullName() { + case "elys.amm.WeightBreakingSlippage.pool_id": + x.PoolId = value.Uint() + case "elys.amm.WeightBreakingSlippage.date": + x.Date = value.Interface().(string) + case "elys.amm.WeightBreakingSlippage.amount": + x.Amount = value.Interface().(string) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.WeightBreakingSlippage")) + } + panic(fmt.Errorf("message elys.amm.WeightBreakingSlippage 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_WeightBreakingSlippage) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "elys.amm.WeightBreakingSlippage.pool_id": + panic(fmt.Errorf("field pool_id of message elys.amm.WeightBreakingSlippage is not mutable")) + case "elys.amm.WeightBreakingSlippage.date": + panic(fmt.Errorf("field date of message elys.amm.WeightBreakingSlippage is not mutable")) + case "elys.amm.WeightBreakingSlippage.amount": + panic(fmt.Errorf("field amount of message elys.amm.WeightBreakingSlippage is not mutable")) + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.WeightBreakingSlippage")) + } + panic(fmt.Errorf("message elys.amm.WeightBreakingSlippage 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_WeightBreakingSlippage) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value { + switch fd.FullName() { + case "elys.amm.WeightBreakingSlippage.pool_id": + return protoreflect.ValueOfUint64(uint64(0)) + case "elys.amm.WeightBreakingSlippage.date": + return protoreflect.ValueOfString("") + case "elys.amm.WeightBreakingSlippage.amount": + return protoreflect.ValueOfString("") + default: + if fd.IsExtension() { + panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.WeightBreakingSlippage")) + } + panic(fmt.Errorf("message elys.amm.WeightBreakingSlippage 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_WeightBreakingSlippage) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor { + switch d.FullName() { + default: + panic(fmt.Errorf("%s is not a oneof field in elys.amm.WeightBreakingSlippage", 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_WeightBreakingSlippage) 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_WeightBreakingSlippage) 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_WeightBreakingSlippage) 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_WeightBreakingSlippage) ProtoMethods() *protoiface.Methods { + size := func(input protoiface.SizeInput) protoiface.SizeOutput { + x := input.Message.Interface().(*WeightBreakingSlippage) + if x == nil { + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: 0, + } + } + options := runtime.SizeInputToOptions(input) + _ = options + var n int + var l int + _ = l + if x.PoolId != 0 { + n += 1 + runtime.Sov(uint64(x.PoolId)) + } + l = len(x.Date) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + l = len(x.Amount) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } + if x.unknownFields != nil { + n += len(x.unknownFields) + } + return protoiface.SizeOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Size: n, + } + } + + marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) { + x := input.Message.Interface().(*WeightBreakingSlippage) + if x == nil { + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + options := runtime.MarshalInputToOptions(input) + _ = options + size := options.Size(x) + dAtA := make([]byte, size) + i := len(dAtA) + _ = i + var l int + _ = l + if x.unknownFields != nil { + i -= len(x.unknownFields) + copy(dAtA[i:], x.unknownFields) + } + if len(x.Amount) > 0 { + i -= len(x.Amount) + copy(dAtA[i:], x.Amount) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Amount))) + i-- + dAtA[i] = 0x1a + } + if len(x.Date) > 0 { + i -= len(x.Date) + copy(dAtA[i:], x.Date) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.Date))) + i-- + dAtA[i] = 0x12 + } + if x.PoolId != 0 { + i = runtime.EncodeVarint(dAtA, i, uint64(x.PoolId)) + i-- + dAtA[i] = 0x8 + } + if input.Buf != nil { + input.Buf = append(input.Buf, dAtA...) + } else { + input.Buf = dAtA + } + return protoiface.MarshalOutput{ + NoUnkeyedLiterals: input.NoUnkeyedLiterals, + Buf: input.Buf, + }, nil + } + unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) { + x := input.Message.Interface().(*WeightBreakingSlippage) + 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: WeightBreakingSlippage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: WeightBreakingSlippage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + x.PoolId = 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.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Date", 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.Date = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow + } + if iNdEx >= l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if postIndex > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + x.Amount = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := runtime.Skip(dAtA[iNdEx:]) + if err != nil { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength + } + if (iNdEx + skippy) > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + if !options.DiscardUnknown { + x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...) + } + iNdEx += skippy + } + } + + if iNdEx > l { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF + } + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil + } + return &protoiface.Methods{ + NoUnkeyedLiterals: struct{}{}, + Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown, + Size: size, + Marshal: marshal, + Unmarshal: unmarshal, + Merge: nil, + CheckInitialized: nil, + } +} + // Code generated by protoc-gen-go. DO NOT EDIT. // versions: // protoc-gen-go v1.27.0 @@ -3146,6 +3678,57 @@ func (x *OraclePoolSlippageTrack) GetTracked() []*v1beta1.Coin { return nil } +type WeightBreakingSlippage struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + Date string `protobuf:"bytes,2,opt,name=date,proto3" json:"date,omitempty"` + Amount string `protobuf:"bytes,3,opt,name=amount,proto3" json:"amount,omitempty"` +} + +func (x *WeightBreakingSlippage) Reset() { + *x = WeightBreakingSlippage{} + if protoimpl.UnsafeEnabled { + mi := &file_elys_amm_pool_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *WeightBreakingSlippage) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*WeightBreakingSlippage) ProtoMessage() {} + +// Deprecated: Use WeightBreakingSlippage.ProtoReflect.Descriptor instead. +func (*WeightBreakingSlippage) Descriptor() ([]byte, []int) { + return file_elys_amm_pool_proto_rawDescGZIP(), []int{4} +} + +func (x *WeightBreakingSlippage) GetPoolId() uint64 { + if x != nil { + return x.PoolId + } + return 0 +} + +func (x *WeightBreakingSlippage) GetDate() string { + if x != nil { + return x.Date + } + return "" +} + +func (x *WeightBreakingSlippage) GetAmount() string { + if x != nil { + return x.Amount + } + return "" +} + var File_elys_amm_pool_proto protoreflect.FileDescriptor var file_elys_amm_pool_proto_rawDesc = []byte{ @@ -3229,16 +3812,25 @@ var file_elys_amm_pool_proto_rawDesc = []byte{ 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, + 0x6f, 0x69, 0x6e, 0x73, 0x52, 0x07, 0x74, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x64, 0x22, 0x90, 0x01, + 0x0a, 0x16, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, + 0x53, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 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, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x61, 0x6d, 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, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, + 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 ( @@ -3253,25 +3845,26 @@ func file_elys_amm_pool_proto_rawDescGZIP() []byte { return file_elys_amm_pool_proto_rawDescData } -var file_elys_amm_pool_proto_msgTypes = make([]protoimpl.MessageInfo, 4) +var file_elys_amm_pool_proto_msgTypes = make([]protoimpl.MessageInfo, 5) var file_elys_amm_pool_proto_goTypes = []interface{}{ (*LegacyPool)(nil), // 0: elys.amm.LegacyPool (*Pool)(nil), // 1: elys.amm.Pool (*PoolExtraInfo)(nil), // 2: elys.amm.PoolExtraInfo (*OraclePoolSlippageTrack)(nil), // 3: elys.amm.OraclePoolSlippageTrack - (*LegacyPoolParams)(nil), // 4: elys.amm.LegacyPoolParams - (*v1beta1.Coin)(nil), // 5: cosmos.base.v1beta1.Coin - (*PoolAsset)(nil), // 6: elys.amm.PoolAsset - (*PoolParams)(nil), // 7: elys.amm.PoolParams + (*WeightBreakingSlippage)(nil), // 4: elys.amm.WeightBreakingSlippage + (*LegacyPoolParams)(nil), // 5: elys.amm.LegacyPoolParams + (*v1beta1.Coin)(nil), // 6: cosmos.base.v1beta1.Coin + (*PoolAsset)(nil), // 7: elys.amm.PoolAsset + (*PoolParams)(nil), // 8: elys.amm.PoolParams } 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.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 - 6, // 5: elys.amm.Pool.pool_assets:type_name -> elys.amm.PoolAsset - 5, // 6: elys.amm.OraclePoolSlippageTrack.tracked:type_name -> cosmos.base.v1beta1.Coin + 5, // 0: elys.amm.LegacyPool.pool_params:type_name -> elys.amm.LegacyPoolParams + 6, // 1: elys.amm.LegacyPool.total_shares:type_name -> cosmos.base.v1beta1.Coin + 7, // 2: elys.amm.LegacyPool.pool_assets:type_name -> elys.amm.PoolAsset + 8, // 3: elys.amm.Pool.pool_params:type_name -> elys.amm.PoolParams + 6, // 4: elys.amm.Pool.total_shares:type_name -> cosmos.base.v1beta1.Coin + 7, // 5: elys.amm.Pool.pool_assets:type_name -> elys.amm.PoolAsset + 6, // 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 7, // [7:7] is the sub-list for extension type_name @@ -3335,6 +3928,18 @@ func file_elys_amm_pool_proto_init() { return nil } } + file_elys_amm_pool_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*WeightBreakingSlippage); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } } type x struct{} out := protoimpl.TypeBuilder{ @@ -3342,7 +3947,7 @@ func file_elys_amm_pool_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_elys_amm_pool_proto_rawDesc, NumEnums: 0, - NumMessages: 4, + NumMessages: 5, NumExtensions: 0, NumServices: 0, }, diff --git a/proto/elys/amm/pool.proto b/proto/elys/amm/pool.proto index 651a9d1b8..62e4da244 100644 --- a/proto/elys/amm/pool.proto +++ b/proto/elys/amm/pool.proto @@ -57,3 +57,13 @@ message OraclePoolSlippageTrack { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; } + +message WeightBreakingSlippage { + uint64 pool_id = 1; + string date = 2; + string amount = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; +} diff --git a/x/amm/keeper/track_weight_breaking_slippage.go b/x/amm/keeper/track_weight_breaking_slippage.go new file mode 100644 index 000000000..fb111fae7 --- /dev/null +++ b/x/amm/keeper/track_weight_breaking_slippage.go @@ -0,0 +1,64 @@ +package keeper + +import ( + "cosmossdk.io/math" + "cosmossdk.io/store/prefix" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/elys-network/elys/x/amm/types" +) + +func (k Keeper) GetWeightAndSlippageFee(ctx sdk.Context, poolId uint64, date string) types.WeightBreakingSlippage { + track := types.WeightBreakingSlippage{} + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.WeightAndSlippagePrefix)) + bz := store.Get(types.WeightAndSlippageFeeKey(poolId, date)) + if len(bz) == 0 { + return types.WeightBreakingSlippage{ + PoolId: poolId, + Date: date, + Amount: math.LegacyZeroDec(), + } + } + + k.cdc.MustUnmarshal(bz, &track) + return track +} + +func (k Keeper) SetWeightAndSlippageFee(ctx sdk.Context, track types.WeightBreakingSlippage) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.WeightAndSlippagePrefix)) + bz := k.cdc.MustMarshal(&track) + store.Set(types.WeightAndSlippageFeeKey(track.PoolId, track.Date), bz) +} + +func (k Keeper) DeleteWeightAndSlippageFee(ctx sdk.Context, poolId uint64, date string) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.WeightAndSlippagePrefix)) + store.Delete(types.WeightAndSlippageFeeKey(poolId, date)) +} + +func (k Keeper) AddWeightAndSlippageFee(ctx sdk.Context, track types.WeightBreakingSlippage) { + store := prefix.NewStore(runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)), []byte(types.WeightAndSlippagePrefix)) + + trackTotal := types.WeightBreakingSlippage{} + bz := store.Get(types.WeightAndSlippageFeeKey(track.PoolId, track.Date)) + if len(bz) == 0 { + trackTotal = track + } else { + k.cdc.MustUnmarshal(bz, &trackTotal) + trackTotal.Amount = trackTotal.Amount.Add(track.Amount) + } + + bz = k.cdc.MustMarshal(&trackTotal) + store.Set(types.WeightAndSlippageFeeKey(track.PoolId, track.Date), bz) +} + +func (k Keeper) TrackWeightBreakingSlippage(ctx sdk.Context, pool types.Pool, slippage sdk.Coin, weightBreakingFee math.LegacyDec) { + track := types.WeightBreakingSlippage{ + PoolId: pool.PoolId, + Date: ctx.BlockTime().Format("2006-01-02"), + Amount: weightBreakingFee, + } + if weightBreakingFee.IsNegative() { + track.Amount = weightBreakingFee.Abs() + } + k.AddWeightAndSlippageFee(ctx, track) +} diff --git a/x/amm/types/keys.go b/x/amm/types/keys.go index a27e9cd5c..6c835b026 100644 --- a/x/amm/types/keys.go +++ b/x/amm/types/keys.go @@ -26,6 +26,8 @@ const ( // OraclePoolSlippageTrackPrefix is the prefix to retrieve slippage tracked OraclePoolSlippageTrackPrefix = "OraclePool/slippage/track/value/" + WeightAndSlippagePrefix = "WeightBreakingFee/slippage/value/" + // DenomLiquidityKeyPrefix is the prefix to retrieve all DenomLiquidity DenomLiquidityKeyPrefix = "DenomLiquidity/value/" @@ -57,6 +59,11 @@ func OraclePoolSlippageTrackKey(poolId uint64, timestamp uint64) []byte { return append(sdk.Uint64ToBigEndian(poolId), sdk.Uint64ToBigEndian(timestamp)...) } +func WeightAndSlippageFeeKey(poolId uint64, date string) []byte { + dateBytes := []byte(date) + return append(sdk.Uint64ToBigEndian(poolId), dateBytes...) +} + // DenomLiquidityKey returns the store key to retrieve a DenomLiquidity from the index fields func DenomLiquidityKey(denom string) []byte { var key []byte diff --git a/x/amm/types/pool.pb.go b/x/amm/types/pool.pb.go index ebd408d22..af9c83226 100644 --- a/x/amm/types/pool.pb.go +++ b/x/amm/types/pool.pb.go @@ -295,54 +295,111 @@ func (m *OraclePoolSlippageTrack) GetTracked() github_com_cosmos_cosmos_sdk_type return nil } +type WeightBreakingSlippage struct { + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + Date string `protobuf:"bytes,2,opt,name=date,proto3" json:"date,omitempty"` + Amount cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=amount,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"amount"` +} + +func (m *WeightBreakingSlippage) Reset() { *m = WeightBreakingSlippage{} } +func (m *WeightBreakingSlippage) String() string { return proto.CompactTextString(m) } +func (*WeightBreakingSlippage) ProtoMessage() {} +func (*WeightBreakingSlippage) Descriptor() ([]byte, []int) { + return fileDescriptor_3ac3be9a215271f9, []int{4} +} +func (m *WeightBreakingSlippage) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *WeightBreakingSlippage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_WeightBreakingSlippage.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 *WeightBreakingSlippage) XXX_Merge(src proto.Message) { + xxx_messageInfo_WeightBreakingSlippage.Merge(m, src) +} +func (m *WeightBreakingSlippage) XXX_Size() int { + return m.Size() +} +func (m *WeightBreakingSlippage) XXX_DiscardUnknown() { + xxx_messageInfo_WeightBreakingSlippage.DiscardUnknown(m) +} + +var xxx_messageInfo_WeightBreakingSlippage proto.InternalMessageInfo + +func (m *WeightBreakingSlippage) GetPoolId() uint64 { + if m != nil { + return m.PoolId + } + return 0 +} + +func (m *WeightBreakingSlippage) GetDate() string { + if m != nil { + return m.Date + } + return "" +} + func init() { proto.RegisterType((*LegacyPool)(nil), "elys.amm.LegacyPool") proto.RegisterType((*Pool)(nil), "elys.amm.Pool") proto.RegisterType((*PoolExtraInfo)(nil), "elys.amm.PoolExtraInfo") proto.RegisterType((*OraclePoolSlippageTrack)(nil), "elys.amm.OraclePoolSlippageTrack") + proto.RegisterType((*WeightBreakingSlippage)(nil), "elys.amm.WeightBreakingSlippage") } func init() { proto.RegisterFile("elys/amm/pool.proto", fileDescriptor_3ac3be9a215271f9) } var fileDescriptor_3ac3be9a215271f9 = []byte{ - // 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, 0x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9d, 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, + // 631 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x94, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0xc7, 0x9b, 0x35, 0xbf, 0xf6, 0x37, 0x77, 0x20, 0xe1, 0x0d, 0x96, 0x15, 0x94, 0x55, 0x3d, + 0x55, 0x42, 0x4d, 0xd8, 0xb8, 0xc1, 0x69, 0xd9, 0x38, 0x54, 0x42, 0x50, 0x65, 0x95, 0x26, 0x71, + 0x89, 0xdc, 0xc4, 0xa4, 0x51, 0xfe, 0x38, 0xb2, 0xdd, 0x6d, 0x3d, 0xf2, 0x0e, 0xf6, 0x3a, 0x90, + 0xb8, 0x21, 0xf1, 0x16, 0x76, 0x9c, 0x38, 0x21, 0x0e, 0x03, 0xb5, 0xaf, 0x81, 0x3b, 0xb2, 0xe3, + 0xac, 0xad, 0xd8, 0x38, 0xf4, 0xcc, 0x29, 0xf1, 0xf3, 0xf8, 0xf9, 0xfa, 0xf3, 0x7c, 0xfd, 0xc8, + 0x60, 0x13, 0x27, 0x13, 0x66, 0xa3, 0x34, 0xb5, 0x73, 0x42, 0x12, 0x2b, 0xa7, 0x84, 0x13, 0xf8, + 0xbf, 0x08, 0x5a, 0x28, 0x4d, 0x9b, 0xcd, 0xa5, 0xb4, 0x97, 0x23, 0x8a, 0x52, 0x56, 0xec, 0x6a, + 0xee, 0x2c, 0xe7, 0x10, 0x63, 0x98, 0xab, 0xd4, 0x56, 0x48, 0x42, 0x22, 0x7f, 0x6d, 0xf1, 0xa7, + 0xa2, 0xa6, 0x4f, 0x58, 0x4a,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87, 0x96, 0x4f, 0x52, 0xf5, 0x96, 0xa8, 0x4f, 0x97, 0x05, 0xb1, 0xcd, 0x27, 0x39, 0x66, + 0xb2, 0x80, 0xb9, 0xa5, 0x76, 0xfb, 0x42, 0x03, 0x8f, 0x8a, 0x3b, 0x72, 0x28, 0x46, 0x71, 0x94, + 0x85, 0x25, 0xfd, 0xdd, 0xe0, 0x10, 0xe8, 0x01, 0xe2, 0xca, 0x3c, 0x57, 0xfe, 0xc3, 0x1e, 0xa8, + 0xa1, 0x94, 0x8c, 0x33, 0x2e, 0x07, 0x7d, 0x25, 0x4b, 0x95, 0x80, 0xe3, 0x5c, 0x4e, 0x4d, 0xed, + 0x6a, 0x6a, 0x6a, 0x3f, 0xa7, 0xa6, 0x76, 0x31, 0x33, 0x2b, 0x57, 0x33, 0xb3, 0xf2, 0x6d, 0x66, + 0x56, 0xde, 0x2d, 0xf6, 0x27, 0xc6, 0xb8, 0x9b, 0x61, 0x7e, 0x46, 0x68, 0x2c, 0x17, 0xf6, 0xb9, + 0x7c, 0x98, 0x65, 0x97, 0xc3, 0x9a, 0x7c, 0x43, 0x9f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x8d, + 0x93, 0x16, 0x09, 0xec, 0x05, 0x00, 0x00, } func (m *LegacyPool) Marshal() (dAtA []byte, err error) { @@ -607,6 +664,51 @@ func (m *OraclePoolSlippageTrack) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *WeightBreakingSlippage) 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 *WeightBreakingSlippage) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *WeightBreakingSlippage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size := m.Amount.Size() + i -= size + if _, err := m.Amount.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + if len(m.Date) > 0 { + i -= len(m.Date) + copy(dAtA[i:], m.Date) + i = encodeVarintPool(dAtA, i, uint64(len(m.Date))) + i-- + dAtA[i] = 0x12 + } + if m.PoolId != 0 { + i = encodeVarintPool(dAtA, i, uint64(m.PoolId)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func encodeVarintPool(dAtA []byte, offset int, v uint64) int { offset -= sovPool(v) base := offset @@ -716,6 +818,24 @@ func (m *OraclePoolSlippageTrack) Size() (n int) { return n } +func (m *WeightBreakingSlippage) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.PoolId != 0 { + n += 1 + sovPool(uint64(m.PoolId)) + } + l = len(m.Date) + if l > 0 { + n += 1 + l + sovPool(uint64(l)) + } + l = m.Amount.Size() + n += 1 + l + sovPool(uint64(l)) + return n +} + func sovPool(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1496,6 +1616,141 @@ func (m *OraclePoolSlippageTrack) Unmarshal(dAtA []byte) error { } return nil } +func (m *WeightBreakingSlippage) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: WeightBreakingSlippage: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: WeightBreakingSlippage: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field PoolId", wireType) + } + m.PoolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.PoolId |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Date", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Date = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipPool(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthPool + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipPool(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 64505b7f4873a336de0edd1e5ef8b55f748041ec Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 10:27:47 +0530 Subject: [PATCH 2/8] add functions --- x/amm/keeper/keeper_swap_exact_amount_in.go | 4 ++++ x/amm/keeper/track_weight_breaking_slippage.go | 10 ++++------ x/amm/keeper/update_pool_for_swap.go | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/x/amm/keeper/keeper_swap_exact_amount_in.go b/x/amm/keeper/keeper_swap_exact_amount_in.go index e7d222307..1901e40ed 100644 --- a/x/amm/keeper/keeper_swap_exact_amount_in.go +++ b/x/amm/keeper/keeper_swap_exact_amount_in.go @@ -67,5 +67,9 @@ func (k Keeper) InternalSwapExactAmountIn( // track slippage k.TrackSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenOutCoin.Denom, slippageAmount.RoundInt())) + if pool.PoolParams.UseOracle { + k.TrackWeightBreakingSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenOutCoin.Denom, slippageAmount.RoundInt())) + } + return tokenOutAmount, nil } diff --git a/x/amm/keeper/track_weight_breaking_slippage.go b/x/amm/keeper/track_weight_breaking_slippage.go index fb111fae7..5572359ec 100644 --- a/x/amm/keeper/track_weight_breaking_slippage.go +++ b/x/amm/keeper/track_weight_breaking_slippage.go @@ -51,14 +51,12 @@ func (k Keeper) AddWeightAndSlippageFee(ctx sdk.Context, track types.WeightBreak store.Set(types.WeightAndSlippageFeeKey(track.PoolId, track.Date), bz) } -func (k Keeper) TrackWeightBreakingSlippage(ctx sdk.Context, pool types.Pool, slippage sdk.Coin, weightBreakingFee math.LegacyDec) { +func (k Keeper) TrackWeightBreakingSlippage(ctx sdk.Context, poolId uint64, token sdk.Coin) { + price := k.oracleKeeper.GetAssetPriceFromDenom(ctx, token.Denom) track := types.WeightBreakingSlippage{ - PoolId: pool.PoolId, + PoolId: poolId, Date: ctx.BlockTime().Format("2006-01-02"), - Amount: weightBreakingFee, - } - if weightBreakingFee.IsNegative() { - track.Amount = weightBreakingFee.Abs() + Amount: price.Mul(math.LegacyNewDecFromInt(token.Amount)), } k.AddWeightAndSlippageFee(ctx, track) } diff --git a/x/amm/keeper/update_pool_for_swap.go b/x/amm/keeper/update_pool_for_swap.go index 308bfed1a..5da440793 100644 --- a/x/amm/keeper/update_pool_for_swap.go +++ b/x/amm/keeper/update_pool_for_swap.go @@ -112,6 +112,9 @@ func (k Keeper) UpdatePoolForSwap( if err != nil { return err } + + // TODO: Some issue in weight breaking fee amount as we already multiply it + k.TrackWeightBreakingSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenIn.Denom, weightRecoveryFeeAmount)) } } From 2f02eff2a054eec9d77b170eb677dc2ce609c231 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 11:05:03 +0530 Subject: [PATCH 3/8] add slippage function --- .../keeper/track_weight_breaking_slippage.go | 22 +++++++++++++++++++ x/masterchef/keeper/fee_info.go | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/x/amm/keeper/track_weight_breaking_slippage.go b/x/amm/keeper/track_weight_breaking_slippage.go index 5572359ec..6fb4d57ee 100644 --- a/x/amm/keeper/track_weight_breaking_slippage.go +++ b/x/amm/keeper/track_weight_breaking_slippage.go @@ -60,3 +60,25 @@ func (k Keeper) TrackWeightBreakingSlippage(ctx sdk.Context, poolId uint64, toke } k.AddWeightAndSlippageFee(ctx, track) } + +// Returns last 7 days avg for weight breaking and slippage +func (k Keeper) GetWeightBreakingSlippageAvg(ctx sdk.Context, poolId uint64) math.LegacyDec { + start := ctx.BlockTime() + count := math.ZeroInt() + total := math.LegacyZeroDec() + + for i := 0; i < 7; i++ { + date := start.AddDate(0, 0, i*-1).Format("2006-01-02") + info := k.GetWeightAndSlippageFee(ctx, poolId, date) + + if info.Amount.IsPositive() { + total = total.Add(info.Amount) + count = count.Add(math.OneInt()) + } + } + + if count.IsZero() { + return math.LegacyZeroDec() + } + return total.Quo(math.LegacyNewDecFromInt(count)) +} diff --git a/x/masterchef/keeper/fee_info.go b/x/masterchef/keeper/fee_info.go index bd43527b8..2063f03af 100644 --- a/x/masterchef/keeper/fee_info.go +++ b/x/masterchef/keeper/fee_info.go @@ -114,7 +114,7 @@ func (k Keeper) GetAvgStakerFeesCollected(ctx sdk.Context) sdkmath.LegacyDec { total := sdkmath.ZeroInt() for i := 0; i < 7; i++ { - date := start.AddDate(0, 0, i).Format("2006-01-02") + date := start.AddDate(0, 0, i*-1).Format("2006-01-02") info := k.GetFeeInfo(ctx, date) collected := info.DexStakers.Add(info.GasStakers).Add(info.PerpStakers) From abc63446436a4d72c719bafee5a7210d049f24a6 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 11:08:47 +0530 Subject: [PATCH 4/8] add to query --- api/elys/amm/pool.pulsar.go | 140 ++++++++++++++++++++++++++++-------- proto/elys/amm/pool.proto | 5 ++ x/amm/keeper/query_pool.go | 5 ++ x/amm/types/pool.pb.go | 130 ++++++++++++++++++++++----------- 4 files changed, 208 insertions(+), 72 deletions(-) diff --git a/api/elys/amm/pool.pulsar.go b/api/elys/amm/pool.pulsar.go index 572d6c18c..fb95191a8 100644 --- a/api/elys/amm/pool.pulsar.go +++ b/api/elys/amm/pool.pulsar.go @@ -1803,6 +1803,7 @@ var ( md_PoolExtraInfo protoreflect.MessageDescriptor fd_PoolExtraInfo_tvl protoreflect.FieldDescriptor fd_PoolExtraInfo_lp_token_price protoreflect.FieldDescriptor + fd_PoolExtraInfo_lp_saved_apr protoreflect.FieldDescriptor ) func init() { @@ -1810,6 +1811,7 @@ func init() { md_PoolExtraInfo = File_elys_amm_pool_proto.Messages().ByName("PoolExtraInfo") fd_PoolExtraInfo_tvl = md_PoolExtraInfo.Fields().ByName("tvl") fd_PoolExtraInfo_lp_token_price = md_PoolExtraInfo.Fields().ByName("lp_token_price") + fd_PoolExtraInfo_lp_saved_apr = md_PoolExtraInfo.Fields().ByName("lp_saved_apr") } var _ protoreflect.Message = (*fastReflection_PoolExtraInfo)(nil) @@ -1889,6 +1891,12 @@ func (x *fastReflection_PoolExtraInfo) Range(f func(protoreflect.FieldDescriptor return } } + if x.LpSavedApr != "" { + value := protoreflect.ValueOfString(x.LpSavedApr) + if !f(fd_PoolExtraInfo_lp_saved_apr, value) { + return + } + } } // Has reports whether a field is populated. @@ -1908,6 +1916,8 @@ func (x *fastReflection_PoolExtraInfo) Has(fd protoreflect.FieldDescriptor) bool return x.Tvl != "" case "elys.amm.PoolExtraInfo.lp_token_price": return x.LpTokenPrice != "" + case "elys.amm.PoolExtraInfo.lp_saved_apr": + return x.LpSavedApr != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.PoolExtraInfo")) @@ -1928,6 +1938,8 @@ func (x *fastReflection_PoolExtraInfo) Clear(fd protoreflect.FieldDescriptor) { x.Tvl = "" case "elys.amm.PoolExtraInfo.lp_token_price": x.LpTokenPrice = "" + case "elys.amm.PoolExtraInfo.lp_saved_apr": + x.LpSavedApr = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.PoolExtraInfo")) @@ -1950,6 +1962,9 @@ func (x *fastReflection_PoolExtraInfo) Get(descriptor protoreflect.FieldDescript case "elys.amm.PoolExtraInfo.lp_token_price": value := x.LpTokenPrice return protoreflect.ValueOfString(value) + case "elys.amm.PoolExtraInfo.lp_saved_apr": + value := x.LpSavedApr + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.PoolExtraInfo")) @@ -1974,6 +1989,8 @@ func (x *fastReflection_PoolExtraInfo) Set(fd protoreflect.FieldDescriptor, valu x.Tvl = value.Interface().(string) case "elys.amm.PoolExtraInfo.lp_token_price": x.LpTokenPrice = value.Interface().(string) + case "elys.amm.PoolExtraInfo.lp_saved_apr": + x.LpSavedApr = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.PoolExtraInfo")) @@ -1998,6 +2015,8 @@ func (x *fastReflection_PoolExtraInfo) Mutable(fd protoreflect.FieldDescriptor) panic(fmt.Errorf("field tvl of message elys.amm.PoolExtraInfo is not mutable")) case "elys.amm.PoolExtraInfo.lp_token_price": panic(fmt.Errorf("field lp_token_price of message elys.amm.PoolExtraInfo is not mutable")) + case "elys.amm.PoolExtraInfo.lp_saved_apr": + panic(fmt.Errorf("field lp_saved_apr of message elys.amm.PoolExtraInfo is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.PoolExtraInfo")) @@ -2015,6 +2034,8 @@ func (x *fastReflection_PoolExtraInfo) NewField(fd protoreflect.FieldDescriptor) return protoreflect.ValueOfString("") case "elys.amm.PoolExtraInfo.lp_token_price": return protoreflect.ValueOfString("") + case "elys.amm.PoolExtraInfo.lp_saved_apr": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.amm.PoolExtraInfo")) @@ -2092,6 +2113,10 @@ func (x *fastReflection_PoolExtraInfo) ProtoMethods() *protoiface.Methods { if l > 0 { n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.LpSavedApr) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -2121,6 +2146,13 @@ func (x *fastReflection_PoolExtraInfo) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.LpSavedApr) > 0 { + i -= len(x.LpSavedApr) + copy(dAtA[i:], x.LpSavedApr) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.LpSavedApr))) + i-- + dAtA[i] = 0x1a + } if len(x.LpTokenPrice) > 0 { i -= len(x.LpTokenPrice) copy(dAtA[i:], x.LpTokenPrice) @@ -2248,6 +2280,38 @@ func (x *fastReflection_PoolExtraInfo) ProtoMethods() *protoiface.Methods { } x.LpTokenPrice = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex + case 3: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LpSavedApr", 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.LpSavedApr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -3591,6 +3655,7 @@ type PoolExtraInfo struct { Tvl string `protobuf:"bytes,1,opt,name=tvl,proto3" json:"tvl,omitempty"` LpTokenPrice string `protobuf:"bytes,2,opt,name=lp_token_price,json=lpTokenPrice,proto3" json:"lp_token_price,omitempty"` + LpSavedApr string `protobuf:"bytes,3,opt,name=lp_saved_apr,json=lpSavedApr,proto3" json:"lp_saved_apr,omitempty"` } func (x *PoolExtraInfo) Reset() { @@ -3627,6 +3692,13 @@ func (x *PoolExtraInfo) GetLpTokenPrice() string { return "" } +func (x *PoolExtraInfo) GetLpSavedApr() string { + if x != nil { + return x.LpSavedApr + } + return "" +} + type OraclePoolSlippageTrack struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -3790,7 +3862,7 @@ var file_elys_amm_pool_proto_rawDesc = []byte{ 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, + 0x75, 0x72, 0x79, 0x22, 0x82, 0x02, 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, @@ -3801,36 +3873,42 @@ var file_elys_amm_pool_proto_rawDesc = []byte{ 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, 0x22, 0x90, 0x01, - 0x0a, 0x16, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, 0x61, 0x6b, 0x69, 0x6e, 0x67, - 0x53, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 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, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x61, 0x6d, 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, 0x06, 0x61, 0x6d, 0x6f, 0x75, 0x6e, 0x74, - 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, + 0x69, 0x63, 0x65, 0x12, 0x53, 0x0a, 0x0c, 0x6c, 0x70, 0x5f, 0x73, 0x61, 0x76, 0x65, 0x64, 0x5f, + 0x61, 0x70, 0x72, 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, 0x0a, 0x6c, 0x70, + 0x53, 0x61, 0x76, 0x65, 0x64, 0x41, 0x70, 0x72, 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, 0x22, 0x90, 0x01, 0x0a, 0x16, 0x57, 0x65, 0x69, 0x67, 0x68, 0x74, 0x42, 0x72, 0x65, + 0x61, 0x6b, 0x69, 0x6e, 0x67, 0x53, 0x6c, 0x69, 0x70, 0x70, 0x61, 0x67, 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, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x64, 0x61, 0x74, 0x65, 0x12, 0x49, 0x0a, 0x06, 0x61, 0x6d, + 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, 0x06, 0x61, + 0x6d, 0x6f, 0x75, 0x6e, 0x74, 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 ( diff --git a/proto/elys/amm/pool.proto b/proto/elys/amm/pool.proto index 62e4da244..f6958da5f 100644 --- a/proto/elys/amm/pool.proto +++ b/proto/elys/amm/pool.proto @@ -47,6 +47,11 @@ message PoolExtraInfo { (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; + string lp_saved_apr = 3 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } message OraclePoolSlippageTrack { diff --git a/x/amm/keeper/query_pool.go b/x/amm/keeper/query_pool.go index b60e8abf5..4623940d1 100644 --- a/x/amm/keeper/query_pool.go +++ b/x/amm/keeper/query_pool.go @@ -2,8 +2,10 @@ package keeper import ( "context" + "github.com/cosmos/cosmos-sdk/runtime" + "cosmossdk.io/math" "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" @@ -15,9 +17,12 @@ import ( func (k Keeper) PoolExtraInfo(ctx sdk.Context, pool types.Pool) types.PoolExtraInfo { tvl, _ := pool.TVL(ctx, k.oracleKeeper, k.accountedPoolKeeper) lpTokenPrice, _ := pool.LpTokenPrice(ctx, k.oracleKeeper, k.accountedPoolKeeper) + avg := k.GetWeightBreakingSlippageAvg(ctx, pool.PoolId) + apr := avg.Mul(math.LegacyNewDec(52)).Quo(tvl) return types.PoolExtraInfo{ Tvl: tvl, LpTokenPrice: lpTokenPrice, + LpSavedApr: apr, } } diff --git a/x/amm/types/pool.pb.go b/x/amm/types/pool.pb.go index af9c83226..0eacdd774 100644 --- a/x/amm/types/pool.pb.go +++ b/x/amm/types/pool.pb.go @@ -200,6 +200,7 @@ func (m *Pool) GetRebalanceTreasury() string { type PoolExtraInfo struct { Tvl cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=tvl,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"tvl"` LpTokenPrice cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=lp_token_price,json=lpTokenPrice,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"lp_token_price"` + LpSavedApr cosmossdk_io_math.LegacyDec `protobuf:"bytes,3,opt,name=lp_saved_apr,json=lpSavedApr,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"lp_saved_apr"` } func (m *PoolExtraInfo) Reset() { *m = PoolExtraInfo{} } @@ -359,47 +360,48 @@ func init() { func init() { proto.RegisterFile("elys/amm/pool.proto", fileDescriptor_3ac3be9a215271f9) } var fileDescriptor_3ac3be9a215271f9 = []byte{ - // 631 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 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e, 0xc3, 0x1e, 0xa8, - 0xa1, 0x94, 0x8c, 0x33, 0x2e, 0x07, 0x7d, 0x25, 0x4b, 0x95, 0x80, 0xe3, 0x5c, 0x4e, 0x4d, 0xed, - 0x6a, 0x6a, 0x6a, 0x3f, 0xa7, 0xa6, 0x76, 0x31, 0x33, 0x2b, 0x57, 0x33, 0xb3, 0xf2, 0x6d, 0x66, - 0x56, 0xde, 0x2d, 0xf6, 0x27, 0xc6, 0xb8, 0x9b, 0x61, 0x7e, 0x46, 0x68, 0x2c, 0x17, 0xf6, 0xb9, - 0x7c, 0x98, 0x65, 0x97, 0xc3, 0x9a, 0x7c, 0x43, 0x9f, 0xff, 0x0e, 0x00, 0x00, 0xff, 0xff, 0x8d, - 0x93, 0x16, 0x09, 0xec, 0x05, 0x00, 0x00, + // 651 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x54, 0x4f, 0x6f, 0xd3, 0x3e, + 0x18, 0x6e, 0xd6, 0xfe, 0xda, 0xdf, 0xdc, 0x81, 0x84, 0x37, 0x58, 0x56, 0x50, 0x56, 0xf5, 0x54, + 0x09, 0x35, 0x61, 0xe3, 0x06, 0xa7, 0x65, 0xe3, 0x50, 0x09, 0xc1, 0x94, 0x4e, 0x9a, 0xc4, 0x25, + 0x7a, 0x9b, 0x98, 0x34, 0x6a, 0x12, 0x5b, 0xb6, 0xf7, 0xa7, 0x47, 0xf8, 0x04, 0xfb, 0x1c, 0x9c, + 0x91, 0xf8, 0x0a, 0x3b, 0x4e, 0x9c, 0x10, 0x87, 0x81, 0xb6, 0xcf, 0xc0, 0x1d, 0xd9, 0x71, 0xb7, + 0x4e, 0x6c, 0x1c, 0x7a, 0xe6, 0x14, 0xfb, 0x7d, 0xfc, 0x3e, 0x7e, 0x9e, 0xc7, 0x8e, 0xd1, 0x32, + 0xc9, 0x26, 0xc2, 0x83, 0x3c, 0xf7, 0x18, 0xa5, 0x99, 0xcb, 0x38, 0x95, 0x14, 0xff, 0xaf, 0x8a, + 0x2e, 0xe4, 0x79, 0xab, 0x75, 0x03, 0x0e, 0x19, 0x70, 0xc8, 0x45, 0xb9, 0xaa, 0xb5, 0x76, 0x13, + 0x03, 0x21, 0x88, 0x34, 0xd0, 0x4a, 0x42, 0x13, 0xaa, 0x87, 0x9e, 0x1a, 0x99, 0xaa, 0x13, 0x51, + 0x91, 0x53, 0xe1, 0x0d, 0x41, 0x10, 0xef, 0x70, 0x63, 0x48, 0x24, 0x6c, 0x78, 0x11, 0x4d, 0x8b, + 0x29, 0x61, 0x89, 0x87, 0x65, 0x63, 0x39, 0x29, 0xa1, 0xce, 0x87, 0x2a, 0x42, 0xaf, 0x49, 0x02, + 0xd1, 0x64, 0x97, 0xd2, 0x0c, 0xaf, 0xa2, 0x86, 0xde, 0x33, 0x8d, 0x6d, 0xab, 0x6d, 0x75, 0x6b, + 0x41, 0x5d, 0x4d, 0xfb, 0x31, 0xb6, 0x51, 0x03, 0xe2, 0x98, 0x13, 0x21, 0xec, 0x85, 0xb6, 0xd5, + 0x5d, 0x0c, 0xa6, 0x53, 0xbc, 0x85, 0x9a, 0x33, 0x16, 0xec, 0x6a, 0xdb, 0xea, 0x36, 0x37, 0x5b, + 0xee, 0xd4, 0xa9, 0x7b, 0xcd, 0xbe, 0xab, 0x57, 0xf8, 0xb5, 0xd3, 0xf3, 0xf5, 0x4a, 0x80, 0xd8, + 0x55, 0x05, 0xfb, 0x68, 0x49, 0x52, 0x09, 0x59, 0x28, 0x46, 0xc0, 0x89, 0xb0, 0x6b, 0x9a, 0x63, + 0xcd, 0x35, 0x4a, 0x95, 0x2d, 0xd7, 0xd8, 0x72, 0xb7, 0x69, 0x5a, 0x18, 0x8a, 0xa6, 0x6e, 0x1a, + 0xe8, 0x1e, 0xfc, 0xc2, 0xc8, 0xd0, 0x69, 0x09, 0xfb, 0xbf, 0x76, 0xb5, 0xdb, 0xdc, 0x5c, 0xbe, + 0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0x62, 0xbc, 0xf3, 0xc5, 0x42, 0xab, 0x6f, 0x39, 0x44, + 0x19, 0x51, 0x51, 0x0c, 0xb2, 0x94, 0x31, 0x48, 0xc8, 0x1e, 0x87, 0x68, 0x7c, 0xf7, 0x7d, 0x7c, + 0x82, 0x16, 0x65, 0x9a, 0x13, 0x21, 0x21, 0x67, 0xda, 0x5d, 0x2d, 0xb8, 0x2e, 0x60, 0x82, 0x1a, + 0x52, 0xf5, 0x93, 0xd8, 0xae, 0xea, 0xeb, 0xf0, 0x97, 0x1b, 0xf5, 0x4c, 0xa9, 0xff, 0xf4, 0x63, + 0xbd, 0x9b, 0xa4, 0x72, 0x74, 0x30, 0x74, 0x23, 0x9a, 0x9b, 0x07, 0xca, 0x7c, 0x7a, 0x22, 0x1e, + 0x7b, 0x72, 0xc2, 0x88, 0xd0, 0x0d, 0x22, 0x98, 0x72, 0x77, 0x4e, 0x2c, 0xf4, 0xa8, 0x3c, 0x78, + 0x9f, 0x13, 0x18, 0xa7, 0x45, 0x32, 0x55, 0x7f, 0xb7, 0x70, 0x8c, 0x6a, 0x31, 0x48, 0x73, 0x22, + 0x81, 0x1e, 0xe3, 0x3e, 0xaa, 0x43, 0x4e, 0x0f, 0x0a, 0x39, 0x7f, 0xa0, 0x86, 0xc0, 0xf7, 0x4f, + 0x2f, 0x1c, 0xeb, 0xec, 0xc2, 0xb1, 0x7e, 0x5e, 0x38, 0xd6, 0xc9, 0xa5, 0x53, 0x39, 0xbb, 0x74, + 0x2a, 0xdf, 0x2e, 0x9d, 0xca, 0xbb, 0x59, 0x7f, 0xea, 0xdf, 0xe8, 0x15, 0x44, 0x1e, 0x51, 0x3e, + 0xd6, 0x13, 0xef, 0x58, 0xbf, 0xf6, 0xda, 0xe5, 0xb0, 0xae, 0x1f, 0xe6, 0xe7, 0xbf, 0x03, 0x00, + 0x00, 0xff, 0xff, 0x4e, 0xeb, 0x14, 0x98, 0x41, 0x06, 0x00, 0x00, } func (m *LegacyPool) Marshal() (dAtA []byte, err error) { @@ -594,6 +596,16 @@ func (m *PoolExtraInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.LpSavedApr.Size() + i -= size + if _, err := m.LpSavedApr.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPool(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size := m.LpTokenPrice.Size() i -= size @@ -794,6 +806,8 @@ func (m *PoolExtraInfo) Size() (n int) { n += 1 + l + sovPool(uint64(l)) l = m.LpTokenPrice.Size() n += 1 + l + sovPool(uint64(l)) + l = m.LpSavedApr.Size() + n += 1 + l + sovPool(uint64(l)) return n } @@ -1473,6 +1487,40 @@ func (m *PoolExtraInfo) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LpSavedApr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPool + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthPool + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthPool + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.LpSavedApr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPool(dAtA[iNdEx:]) From c0b74d9584d4972653da80065cf6714c03ffd218 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 11:12:29 +0530 Subject: [PATCH 5/8] add usd apr --- api/elys/masterchef/query.pulsar.go | 362 +++++++++++++--------- proto/elys/masterchef/query.proto | 5 + x/masterchef/keeper/query_pool_rewards.go | 17 +- x/masterchef/types/query.pb.go | 262 +++++++++------- 4 files changed, 393 insertions(+), 253 deletions(-) diff --git a/api/elys/masterchef/query.pulsar.go b/api/elys/masterchef/query.pulsar.go index d534e54a7..df13938a9 100644 --- a/api/elys/masterchef/query.pulsar.go +++ b/api/elys/masterchef/query.pulsar.go @@ -13029,11 +13029,12 @@ func (x *_PoolRewards_3_list) IsValid() bool { } var ( - md_PoolRewards protoreflect.MessageDescriptor - fd_PoolRewards_pool_id protoreflect.FieldDescriptor - fd_PoolRewards_rewards_usd protoreflect.FieldDescriptor - fd_PoolRewards_reward_coins protoreflect.FieldDescriptor - fd_PoolRewards_eden_forward protoreflect.FieldDescriptor + md_PoolRewards protoreflect.MessageDescriptor + fd_PoolRewards_pool_id protoreflect.FieldDescriptor + fd_PoolRewards_rewards_usd protoreflect.FieldDescriptor + fd_PoolRewards_reward_coins protoreflect.FieldDescriptor + fd_PoolRewards_eden_forward protoreflect.FieldDescriptor + fd_PoolRewards_rewards_usd_apr protoreflect.FieldDescriptor ) func init() { @@ -13043,6 +13044,7 @@ func init() { fd_PoolRewards_rewards_usd = md_PoolRewards.Fields().ByName("rewards_usd") fd_PoolRewards_reward_coins = md_PoolRewards.Fields().ByName("reward_coins") fd_PoolRewards_eden_forward = md_PoolRewards.Fields().ByName("eden_forward") + fd_PoolRewards_rewards_usd_apr = md_PoolRewards.Fields().ByName("rewards_usd_apr") } var _ protoreflect.Message = (*fastReflection_PoolRewards)(nil) @@ -13134,6 +13136,12 @@ func (x *fastReflection_PoolRewards) Range(f func(protoreflect.FieldDescriptor, return } } + if x.RewardsUsdApr != "" { + value := protoreflect.ValueOfString(x.RewardsUsdApr) + if !f(fd_PoolRewards_rewards_usd_apr, value) { + return + } + } } // Has reports whether a field is populated. @@ -13157,6 +13165,8 @@ func (x *fastReflection_PoolRewards) Has(fd protoreflect.FieldDescriptor) bool { return len(x.RewardCoins) != 0 case "elys.masterchef.PoolRewards.eden_forward": return x.EdenForward != nil + case "elys.masterchef.PoolRewards.rewards_usd_apr": + return x.RewardsUsdApr != "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.masterchef.PoolRewards")) @@ -13181,6 +13191,8 @@ func (x *fastReflection_PoolRewards) Clear(fd protoreflect.FieldDescriptor) { x.RewardCoins = nil case "elys.masterchef.PoolRewards.eden_forward": x.EdenForward = nil + case "elys.masterchef.PoolRewards.rewards_usd_apr": + x.RewardsUsdApr = "" default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.masterchef.PoolRewards")) @@ -13212,6 +13224,9 @@ func (x *fastReflection_PoolRewards) Get(descriptor protoreflect.FieldDescriptor case "elys.masterchef.PoolRewards.eden_forward": value := x.EdenForward return protoreflect.ValueOfMessage(value.ProtoReflect()) + case "elys.masterchef.PoolRewards.rewards_usd_apr": + value := x.RewardsUsdApr + return protoreflect.ValueOfString(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.masterchef.PoolRewards")) @@ -13242,6 +13257,8 @@ func (x *fastReflection_PoolRewards) Set(fd protoreflect.FieldDescriptor, value x.RewardCoins = *clv.list case "elys.masterchef.PoolRewards.eden_forward": x.EdenForward = value.Message().Interface().(*v1beta1.Coin) + case "elys.masterchef.PoolRewards.rewards_usd_apr": + x.RewardsUsdApr = value.Interface().(string) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.masterchef.PoolRewards")) @@ -13277,6 +13294,8 @@ func (x *fastReflection_PoolRewards) Mutable(fd protoreflect.FieldDescriptor) pr panic(fmt.Errorf("field pool_id of message elys.masterchef.PoolRewards is not mutable")) case "elys.masterchef.PoolRewards.rewards_usd": panic(fmt.Errorf("field rewards_usd of message elys.masterchef.PoolRewards is not mutable")) + case "elys.masterchef.PoolRewards.rewards_usd_apr": + panic(fmt.Errorf("field rewards_usd_apr of message elys.masterchef.PoolRewards is not mutable")) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.masterchef.PoolRewards")) @@ -13300,6 +13319,8 @@ func (x *fastReflection_PoolRewards) NewField(fd protoreflect.FieldDescriptor) p case "elys.masterchef.PoolRewards.eden_forward": m := new(v1beta1.Coin) return protoreflect.ValueOfMessage(m.ProtoReflect()) + case "elys.masterchef.PoolRewards.rewards_usd_apr": + return protoreflect.ValueOfString("") default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: elys.masterchef.PoolRewards")) @@ -13386,6 +13407,10 @@ func (x *fastReflection_PoolRewards) ProtoMethods() *protoiface.Methods { l = options.Size(x.EdenForward) n += 1 + l + runtime.Sov(uint64(l)) } + l = len(x.RewardsUsdApr) + if l > 0 { + n += 1 + l + runtime.Sov(uint64(l)) + } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -13415,6 +13440,13 @@ func (x *fastReflection_PoolRewards) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } + if len(x.RewardsUsdApr) > 0 { + i -= len(x.RewardsUsdApr) + copy(dAtA[i:], x.RewardsUsdApr) + i = runtime.EncodeVarint(dAtA, i, uint64(len(x.RewardsUsdApr))) + i-- + dAtA[i] = 0x2a + } if x.EdenForward != nil { encoded, err := options.Marshal(x.EdenForward) if err != nil { @@ -13627,6 +13659,38 @@ func (x *fastReflection_PoolRewards) ProtoMethods() *protoiface.Methods { return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err } iNdEx = postIndex + case 5: + if wireType != 2 { + return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field RewardsUsdApr", 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.RewardsUsdApr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -15247,10 +15311,11 @@ type PoolRewards struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - RewardsUsd string `protobuf:"bytes,2,opt,name=rewards_usd,json=rewardsUsd,proto3" json:"rewards_usd,omitempty"` - RewardCoins []*v1beta1.Coin `protobuf:"bytes,3,rep,name=reward_coins,json=rewardCoins,proto3" json:"reward_coins,omitempty"` - EdenForward *v1beta1.Coin `protobuf:"bytes,4,opt,name=eden_forward,json=edenForward,proto3" json:"eden_forward,omitempty"` + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + RewardsUsd string `protobuf:"bytes,2,opt,name=rewards_usd,json=rewardsUsd,proto3" json:"rewards_usd,omitempty"` + RewardCoins []*v1beta1.Coin `protobuf:"bytes,3,rep,name=reward_coins,json=rewardCoins,proto3" json:"reward_coins,omitempty"` + EdenForward *v1beta1.Coin `protobuf:"bytes,4,opt,name=eden_forward,json=edenForward,proto3" json:"eden_forward,omitempty"` + RewardsUsdApr string `protobuf:"bytes,5,opt,name=rewards_usd_apr,json=rewardsUsdApr,proto3" json:"rewards_usd_apr,omitempty"` } func (x *PoolRewards) Reset() { @@ -15301,6 +15366,13 @@ func (x *PoolRewards) GetEdenForward() *v1beta1.Coin { return nil } +func (x *PoolRewards) GetRewardsUsdApr() string { + if x != nil { + return x.RewardsUsdApr + } + return "" +} + type QueryPoolRewardsResponse struct { state protoimpl.MessageState sizeCache protoimpl.SizeCache @@ -15566,7 +15638,7 @@ var file_elys_masterchef_query_proto_rawDesc = []byte{ 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x71, 0x75, 0x65, 0x72, 0x79, 0x2e, 0x76, 0x31, 0x62, 0x65, 0x74, 0x61, 0x31, 0x2e, 0x50, 0x61, 0x67, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x52, 0x0a, 0x70, 0x61, 0x67, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, - 0xae, 0x02, 0x0a, 0x0b, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x12, + 0x89, 0x03, 0x0a, 0x0b, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 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, 0x52, 0x0a, 0x0b, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x5f, 0x75, 0x73, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x42, 0x31, 0xc8, @@ -15585,149 +15657,155 @@ var file_elys_masterchef_query_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, 0x65, 0x64, 0x65, 0x6e, 0x46, 0x6f, 0x72, 0x77, 0x61, 0x72, 0x64, - 0x22, 0x54, 0x0a, 0x18, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, - 0x70, 0x6f, 0x6f, 0x6c, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x6c, - 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x50, 0x6f, - 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, - 0x05, 0x70, 0x6f, 0x6f, 0x6c, 0x73, 0x32, 0xdc, 0x0f, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x12, 0x81, 0x01, 0x0a, 0x06, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x2e, 0x65, 0x6c, + 0x12, 0x59, 0x0a, 0x0f, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x5f, 0x75, 0x73, 0x64, 0x5f, + 0x61, 0x70, 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, 0x0d, 0x72, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x73, 0x55, 0x73, 0x64, 0x41, 0x70, 0x72, 0x22, 0x54, 0x0a, 0x18, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x05, 0x70, 0x6f, 0x6f, 0x6c, 0x73, + 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x1c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x73, 0x42, 0x04, 0xc8, 0xde, 0x1f, 0x00, 0x52, 0x05, 0x70, 0x6f, 0x6f, 0x6c, + 0x73, 0x32, 0xdc, 0x0f, 0x0a, 0x05, 0x51, 0x75, 0x65, 0x72, 0x79, 0x12, 0x81, 0x01, 0x0a, 0x06, + 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, 0x23, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, + 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x24, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, - 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x12, 0x24, + 0x65, 0x72, 0x79, 0x50, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x2c, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x26, 0x12, 0x24, 0x2f, 0x65, 0x6c, 0x79, 0x73, + 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x61, 0x72, 0x61, 0x6d, 0x73, 0x12, + 0xae, 0x01, 0x0a, 0x11, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x65, + 0x6e, 0x74, 0x69, 0x76, 0x65, 0x12, 0x2e, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, + 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, + 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x45, 0x78, 0x74, + 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, - 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x61, - 0x72, 0x61, 0x6d, 0x73, 0x12, 0xae, 0x01, 0x0a, 0x11, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, - 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, 0x12, 0x2e, 0x2e, 0x65, 0x6c, 0x79, - 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, - 0x69, 0x76, 0x65, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x65, 0x6c, 0x79, - 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, - 0x72, 0x79, 0x45, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x49, 0x6e, 0x63, 0x65, 0x6e, 0x74, - 0x69, 0x76, 0x65, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x32, 0x12, 0x30, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x65, 0x78, + 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x63, 0x65, 0x6e, 0x74, 0x69, 0x76, 0x65, + 0x12, 0x8a, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x6f, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x25, 0x2e, + 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, + 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, + 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0xa3, 0x01, + 0x0a, 0x0e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, + 0x12, 0x2b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, + 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, + 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, + 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, + 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, - 0x65, 0x66, 0x2f, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x61, 0x6c, 0x5f, 0x69, 0x6e, 0x63, 0x65, - 0x6e, 0x74, 0x69, 0x76, 0x65, 0x12, 0x8a, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x6f, 0x6c, 0x49, 0x6e, - 0x66, 0x6f, 0x12, 0x25, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, - 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x49, 0x6e, - 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x65, 0x6c, 0x79, 0x73, + 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x5f, 0x69, + 0x6e, 0x66, 0x6f, 0x12, 0xa3, 0x01, 0x0a, 0x0e, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, + 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, + 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, + 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, + 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x69, 0x6e, - 0x66, 0x6f, 0x12, 0xa3, 0x01, 0x0a, 0x0e, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, - 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, - 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, - 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, - 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, - 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x72, 0x65, + 0x77, 0x61, 0x72, 0x64, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0xaa, 0x01, 0x0a, 0x11, 0x55, 0x73, + 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, + 0x2e, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, + 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, + 0x2f, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, + 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, + 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x34, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x12, 0x2c, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, - 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x77, - 0x61, 0x72, 0x64, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0xa3, 0x01, 0x0a, 0x0e, 0x55, 0x73, 0x65, - 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x2b, 0x2e, 0x65, 0x6c, - 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, - 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, + 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x5f, + 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0xab, 0x01, 0x0a, 0x0e, 0x53, 0x74, 0x61, 0x62, 0x6c, + 0x65, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x72, 0x12, 0x2b, 0x2e, 0x65, 0x6c, 0x79, 0x73, + 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, + 0x79, 0x53, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, + 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x72, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x38, 0x12, 0x36, 0x2f, 0x65, + 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, + 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x73, 0x74, 0x61, 0x62, + 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, 0x70, 0x72, 0x2f, 0x7b, 0x64, 0x65, + 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x08, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x70, 0x72, + 0x73, 0x12, 0x25, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, + 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x70, 0x72, + 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, - 0x55, 0x73, 0x65, 0x72, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, - 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x36, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x30, 0x12, 0x2e, - 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, - 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x75, 0x73, - 0x65, 0x72, 0x5f, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0xaa, - 0x01, 0x0a, 0x11, 0x55, 0x73, 0x65, 0x72, 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x12, 0x2e, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, - 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, - 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x71, - 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2f, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, - 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x55, 0x73, 0x65, 0x72, - 0x50, 0x65, 0x6e, 0x64, 0x69, 0x6e, 0x67, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x34, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x12, 0x2c, 0x2f, - 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, - 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x65, 0x6e, - 0x64, 0x69, 0x6e, 0x67, 0x5f, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x12, 0xab, 0x01, 0x0a, 0x0e, - 0x53, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, 0x72, 0x12, 0x2b, - 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, - 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x6b, - 0x65, 0x41, 0x70, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2c, 0x2e, 0x65, 0x6c, + 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x70, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, + 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, + 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x61, 0x70, 0x72, + 0x73, 0x12, 0x9e, 0x01, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x77, 0x46, 0x65, 0x65, 0x49, 0x6e, 0x66, + 0x6f, 0x12, 0x28, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, + 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x68, 0x6f, 0x77, 0x46, 0x65, 0x65, + 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x53, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x53, 0x74, 0x61, 0x6b, 0x65, 0x41, 0x70, - 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3e, 0x82, 0xd3, 0xe4, 0x93, 0x02, - 0x38, 0x12, 0x36, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, + 0x65, 0x72, 0x79, 0x53, 0x68, 0x6f, 0x77, 0x46, 0x65, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x34, 0x12, 0x32, + 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, + 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x73, 0x68, + 0x6f, 0x77, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x2f, 0x7b, 0x64, 0x61, 0x74, + 0x65, 0x7d, 0x12, 0x97, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, 0x49, 0x6e, + 0x66, 0x6f, 0x12, 0x28, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, + 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, + 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x65, + 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, + 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2d, 0x12, + 0x2b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, + 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x6c, + 0x69, 0x73, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, 0x12, 0x8d, 0x01, 0x0a, + 0x03, 0x41, 0x70, 0x72, 0x12, 0x20, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, + 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x72, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, + 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, 0x82, 0xd3, 0xe4, 0x93, 0x02, + 0x3b, 0x12, 0x39, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, - 0x2f, 0x73, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x5f, 0x73, 0x74, 0x61, 0x6b, 0x65, 0x5f, 0x61, 0x70, - 0x72, 0x2f, 0x7b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0x8a, 0x01, 0x0a, 0x08, 0x50, 0x6f, - 0x6f, 0x6c, 0x41, 0x70, 0x72, 0x73, 0x12, 0x25, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, - 0x6f, 0x6c, 0x41, 0x70, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x26, 0x2e, - 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, - 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x41, 0x70, 0x72, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2f, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x29, 0x12, 0x27, 0x2f, - 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, - 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, - 0x6c, 0x5f, 0x61, 0x70, 0x72, 0x73, 0x12, 0x9e, 0x01, 0x0a, 0x0b, 0x53, 0x68, 0x6f, 0x77, 0x46, - 0x65, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x28, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x68, - 0x6f, 0x77, 0x46, 0x65, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, - 0x1a, 0x29, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, - 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x53, 0x68, 0x6f, 0x77, 0x46, 0x65, 0x65, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x3a, 0x82, 0xd3, 0xe4, - 0x93, 0x02, 0x34, 0x12, 0x32, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, + 0x2f, 0x61, 0x70, 0x72, 0x2f, 0x7b, 0x77, 0x69, 0x74, 0x68, 0x64, 0x72, 0x61, 0x77, 0x5f, 0x74, + 0x79, 0x70, 0x65, 0x7d, 0x2f, 0x7b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, 0x7d, 0x12, 0x79, 0x0a, 0x04, + 0x41, 0x70, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, + 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, + 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x41, + 0x70, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2a, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, - 0x65, 0x66, 0x2f, 0x73, 0x68, 0x6f, 0x77, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x66, 0x6f, - 0x2f, 0x7b, 0x64, 0x61, 0x74, 0x65, 0x7d, 0x12, 0x97, 0x01, 0x0a, 0x0b, 0x4c, 0x69, 0x73, 0x74, - 0x46, 0x65, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x28, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, - 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, - 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x65, 0x66, 0x2f, 0x61, 0x70, 0x72, 0x73, 0x12, 0x96, 0x01, 0x0a, 0x0b, 0x50, 0x6f, 0x6f, 0x6c, + 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x12, 0x28, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, + 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, - 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x4c, 0x69, 0x73, 0x74, 0x46, 0x65, 0x65, - 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x33, 0x82, 0xd3, - 0xe4, 0x93, 0x02, 0x2d, 0x12, 0x2b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, + 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, + 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x32, 0x82, 0xd3, + 0xe4, 0x93, 0x02, 0x2c, 0x12, 0x2a, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, - 0x68, 0x65, 0x66, 0x2f, 0x6c, 0x69, 0x73, 0x74, 0x5f, 0x66, 0x65, 0x65, 0x5f, 0x69, 0x6e, 0x66, - 0x6f, 0x12, 0x8d, 0x01, 0x0a, 0x03, 0x41, 0x70, 0x72, 0x12, 0x20, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x41, 0x70, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x65, 0x6c, - 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, - 0x65, 0x72, 0x79, 0x41, 0x70, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x41, - 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3b, 0x12, 0x39, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, 0x6e, 0x65, - 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, 0x74, 0x65, - 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, 0x70, 0x72, 0x2f, 0x7b, 0x77, 0x69, 0x74, 0x68, 0x64, - 0x72, 0x61, 0x77, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x7d, 0x2f, 0x7b, 0x64, 0x65, 0x6e, 0x6f, 0x6d, - 0x7d, 0x12, 0x79, 0x0a, 0x04, 0x41, 0x70, 0x72, 0x73, 0x12, 0x21, 0x2e, 0x65, 0x6c, 0x79, 0x73, - 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, - 0x79, 0x41, 0x70, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x22, 0x2e, 0x65, - 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x41, 0x70, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, - 0x22, 0x2a, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x24, 0x12, 0x22, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2d, - 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, 0x73, - 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x61, 0x70, 0x72, 0x73, 0x12, 0x96, 0x01, 0x0a, - 0x0b, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x12, 0x28, 0x2e, 0x65, - 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, - 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x29, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2e, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, 0x6f, - 0x6f, 0x6c, 0x52, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x32, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2c, 0x12, 0x2a, 0x2f, 0x65, 0x6c, 0x79, 0x73, - 0x2d, 0x6e, 0x65, 0x74, 0x77, 0x6f, 0x72, 0x6b, 0x2f, 0x65, 0x6c, 0x79, 0x73, 0x2f, 0x6d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, - 0x77, 0x61, 0x72, 0x64, 0x73, 0x42, 0xb0, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, - 0x79, 0x73, 0x2e, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x42, 0x0a, 0x51, - 0x75, 0x65, 0x72, 0x79, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 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, 0x6d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0xa2, 0x02, 0x03, - 0x45, 0x4d, 0x58, 0xaa, 0x02, 0x0f, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x4d, 0x61, 0x73, 0x74, 0x65, - 0x72, 0x63, 0x68, 0x65, 0x66, 0xca, 0x02, 0x0f, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x4d, 0x61, 0x73, - 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0xe2, 0x02, 0x1b, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x4d, - 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, - 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x10, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x4d, 0x61, - 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x68, 0x65, 0x66, 0x2f, 0x70, 0x6f, 0x6f, 0x6c, 0x5f, 0x72, 0x65, 0x77, 0x61, 0x72, 0x64, 0x73, + 0x42, 0xb0, 0x01, 0x0a, 0x13, 0x63, 0x6f, 0x6d, 0x2e, 0x65, 0x6c, 0x79, 0x73, 0x2e, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0x42, 0x0a, 0x51, 0x75, 0x65, 0x72, 0x79, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 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, 0x6d, 0x61, + 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, 0xa2, 0x02, 0x03, 0x45, 0x4d, 0x58, 0xaa, 0x02, + 0x0f, 0x45, 0x6c, 0x79, 0x73, 0x2e, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, 0x65, 0x66, + 0xca, 0x02, 0x0f, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, 0x68, + 0x65, 0x66, 0xe2, 0x02, 0x1b, 0x45, 0x6c, 0x79, 0x73, 0x5c, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, + 0x63, 0x68, 0x65, 0x66, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x10, 0x45, 0x6c, 0x79, 0x73, 0x3a, 0x3a, 0x4d, 0x61, 0x73, 0x74, 0x65, 0x72, 0x63, + 0x68, 0x65, 0x66, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, } var ( diff --git a/proto/elys/masterchef/query.proto b/proto/elys/masterchef/query.proto index 95662c88e..167ac66c1 100644 --- a/proto/elys/masterchef/query.proto +++ b/proto/elys/masterchef/query.proto @@ -272,6 +272,11 @@ message PoolRewards { (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" ]; cosmos.base.v1beta1.Coin eden_forward = 4 [ (gogoproto.nullable) = false ]; + string rewards_usd_apr = 5 [ + (cosmos_proto.scalar) = "cosmos.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", + (gogoproto.nullable) = false + ]; } message QueryPoolRewardsResponse { repeated PoolRewards pools = 1 [ (gogoproto.nullable) = false ]; diff --git a/x/masterchef/keeper/query_pool_rewards.go b/x/masterchef/keeper/query_pool_rewards.go index 4d1dd980f..42bb6f45c 100644 --- a/x/masterchef/keeper/query_pool_rewards.go +++ b/x/masterchef/keeper/query_pool_rewards.go @@ -3,6 +3,7 @@ package keeper import ( "context" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ammtypes "github.com/elys-network/elys/x/amm/types" "github.com/elys-network/elys/x/masterchef/types" @@ -74,11 +75,19 @@ func (k *Keeper) generatePoolRewards(ctx sdk.Context, ammPool *ammtypes.Pool) ty // Get rewards amount rewardsUsd, rewardCoins := k.GetDailyRewardsAmountForPool(ctx, ammPool.PoolId) edenForward := sdk.NewCoin(ptypes.Eden, k.ForwardEdenCalc(ctx, ammPool.PoolId).RoundInt()) + tvl, err := ammPool.TVL(ctx, k.oracleKeeper, k.accountedPoolKeeper) + apr := rewardsUsd.Mul(math.LegacyNewDec(365)) + if err != nil { + apr = math.LegacyZeroDec() + } else { + apr = apr.Quo(tvl) + } return types.PoolRewards{ - PoolId: ammPool.PoolId, - RewardsUsd: rewardsUsd, - RewardCoins: rewardCoins, - EdenForward: edenForward, + PoolId: ammPool.PoolId, + RewardsUsd: rewardsUsd, + RewardCoins: rewardCoins, + EdenForward: edenForward, + RewardsUsdApr: apr, } } diff --git a/x/masterchef/types/query.pb.go b/x/masterchef/types/query.pb.go index 0148b56e4..2756f4d33 100644 --- a/x/masterchef/types/query.pb.go +++ b/x/masterchef/types/query.pb.go @@ -1250,10 +1250,11 @@ func (m *QueryPoolRewardsRequest) GetPagination() *query.PageRequest { } type PoolRewards struct { - PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` - RewardsUsd cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=rewards_usd,json=rewardsUsd,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rewards_usd"` - RewardCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=reward_coins,json=rewardCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_coins"` - EdenForward types.Coin `protobuf:"bytes,4,opt,name=eden_forward,json=edenForward,proto3" json:"eden_forward"` + PoolId uint64 `protobuf:"varint,1,opt,name=pool_id,json=poolId,proto3" json:"pool_id,omitempty"` + RewardsUsd cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=rewards_usd,json=rewardsUsd,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rewards_usd"` + RewardCoins github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,3,rep,name=reward_coins,json=rewardCoins,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"reward_coins"` + EdenForward types.Coin `protobuf:"bytes,4,opt,name=eden_forward,json=edenForward,proto3" json:"eden_forward"` + RewardsUsdApr cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=rewards_usd_apr,json=rewardsUsdApr,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"rewards_usd_apr"` } func (m *PoolRewards) Reset() { *m = PoolRewards{} } @@ -1389,109 +1390,110 @@ func init() { func init() { proto.RegisterFile("elys/masterchef/query.proto", fileDescriptor_e4939d0b7ced5d80) } var fileDescriptor_e4939d0b7ced5d80 = []byte{ - // 1621 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xdf, 0x6f, 0x13, 0x57, - 0x16, 0xce, 0x38, 0x4e, 0xec, 0x1c, 0x87, 0x40, 0xee, 0x66, 0x85, 0xe3, 0xb0, 0x4e, 0xb8, 0xcb, - 0xb2, 0x01, 0x12, 0x0f, 0x31, 0x2c, 0x82, 0xdd, 0x15, 0x52, 0xc2, 0x0f, 0x29, 0xda, 0x68, 0x97, - 0x35, 0x44, 0x54, 0x7d, 0xb1, 0xc6, 0x9e, 0x1b, 0x67, 0x14, 0x7b, 0x66, 0x98, 0x3b, 0x21, 0x58, - 0x94, 0x07, 0xfa, 0x88,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0x19, 0x8f, 0x10, 0xa8, 0x3b, 0xad, 0x96, 0xe5, 0xb7, - 0x98, 0xed, 0x47, 0x09, 0xcc, 0x2b, 0xfa, 0x55, 0x95, 0x21, 0xf5, 0xa0, 0x96, 0xe8, 0x1c, 0x90, - 0xff, 0x8b, 0xd8, 0xef, 0x48, 0xfb, 0x0a, 0x7b, 0xb0, 0xcf, 0xb8, 0x4f, 0xb7, 0xe0, 0x4f, 0x91, - 0xb7, 0xdc, 0x75, 0x6c, 0xce, 0xc8, 0x3f, 0x60, 0x52, 0xe1, 0xe6, 0xb5, 0x25, 0x6d, 0x39, 0x57, - 0x3e, 0x59, 0xea, 0x39, 0x88, 0x92, 0xda, 0xb0, 0x91, 0x7e, 0xf9, 0x7a, 0x71, 0xac, 0x82, 0xc6, - 0x54, 0x87, 0xbf, 0x48, 0xb4, 0x5b, 0x18, 0xf6, 0x66, 0x10, 0x35, 0xba, 0x23, 0x33, 0x90, 0xb2, - 0x4c, 0x89, 0x99, 0xae, 0xa4, 0x2c, 0x93, 0xb6, 0xa1, 0x98, 0xb4, 0x01, 0x99, 0xdc, 0x07, 0x12, - 0x4f, 0x22, 0xb2, 0xa2, 0x31, 0x56, 0x31, 0x1c, 0x24, 0x38, 0xcb, 0x7a, 0x17, 0xa8, 0x0e, 0x73, - 0x2a, 0x72, 0xc7, 0x69, 0x6e, 0xda, 0x3b, 0x4e, 0x40, 0xf1, 0x24, 0x64, 0xc4, 0x59, 0x54, 0x3b, - 0x3c, 0x27, 0xc5, 0xe3, 0xa6, 0x49, 0xb7, 0xe1, 0xcf, 0x3d, 0x1b, 0x90, 0xe2, 0xbf, 0x61, 0x4a, - 0xed, 0xb0, 0x77, 0x1c, 0x64, 0x36, 0x1f, 0xcf, 0x17, 0xee, 0x42, 0x42, 0x59, 0x17, 0x9f, 0xe9, - 0x07, 0x50, 0xe8, 0xc0, 0x56, 0xd8, 0x81, 0xe1, 0x99, 0xc3, 0xb0, 0x21, 0xa7, 0x61, 0xda, 0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7, 0x9c, 0xe8, 0x20, 0x13, 0x64, 0x74, 0x5e, 0x32, 0x3a, 0x43, 0xe8, - 0xa1, 0x8c, 0x38, 0xf9, 0x42, 0x8b, 0x0e, 0x33, 0xcb, 0x87, 0xdd, 0xa4, 0xfc, 0x90, 0x43, 0xea, - 0xf3, 0x91, 0xa7, 0x65, 0x49, 0x68, 0x85, 0x9c, 0x1f, 0xfa, 0xc2, 0xe5, 0x1b, 0x9b, 0x2f, 0xdf, - 0x14, 0xb5, 0x57, 0x6f, 0x8a, 0xda, 0xaf, 0x6f, 0x8a, 0xda, 0x67, 0x6f, 0x8b, 0x63, 0xaf, 0xde, - 0x16, 0xc7, 0x7e, 0x7c, 0x5b, 0x1c, 0xfb, 0x50, 0x0f, 0x4d, 0x32, 0x71, 0xbc, 0x47, 0xb1, 0x7f, - 0x5b, 0xd7, 0x26, 0xe5, 0xbf, 0x9f, 0x2f, 0xfd, 0x1e, 0x00, 0x00, 0xff, 0xff, 0x02, 0xb6, 0x58, - 0x43, 0xe8, 0x17, 0x00, 0x00, + // 1633 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0xcf, 0x6f, 0x1b, 0x45, + 0x14, 0xce, 0xda, 0x4e, 0xec, 0x3c, 0xe7, 0x47, 0x33, 0x04, 0xd5, 0x71, 0x8a, 0x93, 0x0e, 0xa5, + 0xa4, 0x6d, 0xe2, 0x6d, 0xdc, 0x52, 0xb5, 0x80, 0x2a, 0x25, 0xfd, 0x21, 0x45, 0x44, 0x50, 0xdc, + 0x46, 0x05, 0x2e, 0xd6, 0xda, 0x9e, 0x38, 0xab, 0xd8, 0xbb, 0xee, 0xce, 0xa6, 0xa9, 0x55, 0x7a, + 0x28, 0x37, 0x2a, 0x81, 0x90, 0x90, 0xe0, 0xc6, 0x85, 0x5b, 0x91, 0x38, 0xf1, 0x47, 0x94, 0x5b, + 0x05, 0x17, 0x84,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0x89, 0xf6, 0x33, 0x41, 0x46, 0xa7, 0x25, 0xa3, 0x13, 0x84, 0x1e, 0xc8, 0x88, 0x93, 0xef, + 0xb4, 0xe0, 0x3d, 0x69, 0xe9, 0xa0, 0x93, 0x94, 0x1f, 0xb0, 0x49, 0x3d, 0x3e, 0xf2, 0xb4, 0x20, + 0x09, 0x2d, 0x93, 0xd3, 0x03, 0x1f, 0xb8, 0x7c, 0x7d, 0xe3, 0xc9, 0xf3, 0x9c, 0xf6, 0xf4, 0x79, + 0x4e, 0xfb, 0xe7, 0x79, 0x4e, 0xfb, 0xe6, 0x45, 0x6e, 0xe4, 0xe9, 0x8b, 0xdc, 0xc8, 0x1f, 0x2f, + 0x72, 0x23, 0x9f, 0xe9, 0xbe, 0x4b, 0x52, 0x18, 0xef, 0x5e, 0xe8, 0x3f, 0xe2, 0xe5, 0x31, 0xf9, + 0x9f, 0xed, 0x73, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x79, 0xb8, 0x16, 0x81, 0x43, 0x18, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3071,6 +3073,16 @@ func (m *PoolRewards) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.RewardsUsdApr.Size() + i -= size + if _, err := m.RewardsUsdApr.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a { size, err := m.EdenForward.MarshalToSizedBuffer(dAtA[:i]) if err != nil { @@ -3562,6 +3574,8 @@ func (m *PoolRewards) Size() (n int) { } l = m.EdenForward.Size() n += 1 + l + sovQuery(uint64(l)) + l = m.RewardsUsdApr.Size() + n += 1 + l + sovQuery(uint64(l)) return n } @@ -6508,6 +6522,40 @@ func (m *PoolRewards) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RewardsUsdApr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.RewardsUsdApr.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) From 4827658d0a5d78b1422c0a4e19eeb23d6e2a906f Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 11:24:58 +0530 Subject: [PATCH 6/8] fix --- x/masterchef/keeper/query_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x/masterchef/keeper/query_test.go b/x/masterchef/keeper/query_test.go index 3f83716aa..c320937a4 100644 --- a/x/masterchef/keeper/query_test.go +++ b/x/masterchef/keeper/query_test.go @@ -172,10 +172,11 @@ func (suite *MasterchefKeeperTestSuite) TestPoolRewards() { }, response: &types.QueryPoolRewardsResponse{ Pools: []types.PoolRewards{{ - PoolId: 1, - RewardsUsd: sdkmath.LegacyNewDec(420), - RewardCoins: sdk.Coins{sdk.NewCoin(ptypes.Eden, sdkmath.NewInt(200)), sdk.NewCoin(ptypes.BaseCurrency, sdkmath.NewInt(400))}, - EdenForward: sdk.NewCoin(ptypes.Eden, sdkmath.NewInt(0)), + PoolId: 1, + RewardsUsd: sdkmath.LegacyNewDec(420), + RewardCoins: sdk.Coins{sdk.NewCoin(ptypes.Eden, sdkmath.NewInt(200)), sdk.NewCoin(ptypes.BaseCurrency, sdkmath.NewInt(400))}, + EdenForward: sdk.NewCoin(ptypes.Eden, sdkmath.NewInt(0)), + RewardsUsdApr: sdkmath.LegacyMustNewDecFromStr("1531.468531468531468531"), }, }, }, From f9f9fb89bd5101cb7445659edde8497fc9fcec09 Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 12:05:10 +0530 Subject: [PATCH 7/8] fix --- x/amm/keeper/query_pool.go | 5 ++++- x/amm/keeper/update_pool_for_swap.go | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/x/amm/keeper/query_pool.go b/x/amm/keeper/query_pool.go index 4623940d1..945730fc4 100644 --- a/x/amm/keeper/query_pool.go +++ b/x/amm/keeper/query_pool.go @@ -18,7 +18,10 @@ func (k Keeper) PoolExtraInfo(ctx sdk.Context, pool types.Pool) types.PoolExtraI tvl, _ := pool.TVL(ctx, k.oracleKeeper, k.accountedPoolKeeper) lpTokenPrice, _ := pool.LpTokenPrice(ctx, k.oracleKeeper, k.accountedPoolKeeper) avg := k.GetWeightBreakingSlippageAvg(ctx, pool.PoolId) - apr := avg.Mul(math.LegacyNewDec(52)).Quo(tvl) + apr := math.LegacyZeroDec() + if tvl.IsPositive() { + apr = avg.Mul(math.LegacyNewDec(52)).Quo(tvl) + } return types.PoolExtraInfo{ Tvl: tvl, LpTokenPrice: lpTokenPrice, diff --git a/x/amm/keeper/update_pool_for_swap.go b/x/amm/keeper/update_pool_for_swap.go index 5da440793..f11a111e4 100644 --- a/x/amm/keeper/update_pool_for_swap.go +++ b/x/amm/keeper/update_pool_for_swap.go @@ -113,7 +113,6 @@ func (k Keeper) UpdatePoolForSwap( return err } - // TODO: Some issue in weight breaking fee amount as we already multiply it k.TrackWeightBreakingSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenIn.Denom, weightRecoveryFeeAmount)) } From 52b49dac2b744c677f375f288eb493bc2d5f53bd Mon Sep 17 00:00:00 2001 From: Amit Date: Fri, 6 Dec 2024 12:09:17 +0530 Subject: [PATCH 8/8] for pool --- x/amm/keeper/update_pool_for_swap.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/x/amm/keeper/update_pool_for_swap.go b/x/amm/keeper/update_pool_for_swap.go index f11a111e4..b88ab1039 100644 --- a/x/amm/keeper/update_pool_for_swap.go +++ b/x/amm/keeper/update_pool_for_swap.go @@ -113,7 +113,15 @@ func (k Keeper) UpdatePoolForSwap( return err } - k.TrackWeightBreakingSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenIn.Denom, weightRecoveryFeeAmount)) + // Track amount in pool + weightRecoveryFeeAmountForPool := sdkmath.ZeroInt() + weightRecoveryFeeForPool := weightBalanceBonus.Abs().Mul(sdkmath.LegacyOneDec().Sub(params.WeightBreakingFeePortion)) + if givenOut { + weightRecoveryFeeAmountForPool = oracleInAmount.ToLegacyDec().Mul(weightRecoveryFeeForPool).RoundInt() + } else { + weightRecoveryFeeAmountForPool = tokenIn.Amount.ToLegacyDec().Mul(weightRecoveryFeeForPool).RoundInt() + } + k.TrackWeightBreakingSlippage(ctx, pool.PoolId, sdk.NewCoin(tokenIn.Denom, weightRecoveryFeeAmountForPool)) } }