diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts index bde0abe52e..720980b76d 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts @@ -69,6 +69,9 @@ export interface Perpetual { */ fundingIndex: Uint8Array; + /** Total size of open long contracts, measured in base_quantums. */ + + openInterest: Uint8Array; } /** Perpetual represents a perpetual on the dYdX exchange. */ @@ -81,6 +84,9 @@ export interface PerpetualSDKType { */ funding_index: Uint8Array; + /** Total size of open long contracts, measured in base_quantums. */ + + open_interest: Uint8Array; } /** * PerpetualParams represents the parameters of a perpetual on the dYdX @@ -280,6 +286,19 @@ export interface LiquidityTier { */ impactNotional: Long; + /** + * Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF is not affected when OI <= open_interest_lower_cap. + */ + + openInterestLowerCap: Long; + /** + * Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + * If zero, then the IMF does not scale with OI. + */ + + openInterestUpperCap: Long; } /** LiquidityTier stores margin information. */ @@ -323,12 +342,26 @@ export interface LiquidityTierSDKType { */ impact_notional: Long; + /** + * Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF is not affected when OI <= open_interest_lower_cap. + */ + + open_interest_lower_cap: Long; + /** + * Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + * IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + * If zero, then the IMF does not scale with OI. + */ + + open_interest_upper_cap: Long; } function createBasePerpetual(): Perpetual { return { params: undefined, - fundingIndex: new Uint8Array() + fundingIndex: new Uint8Array(), + openInterest: new Uint8Array() }; } @@ -342,6 +375,10 @@ export const Perpetual = { writer.uint32(18).bytes(message.fundingIndex); } + if (message.openInterest.length !== 0) { + writer.uint32(26).bytes(message.openInterest); + } + return writer; }, @@ -362,6 +399,10 @@ export const Perpetual = { message.fundingIndex = reader.bytes(); break; + case 3: + message.openInterest = reader.bytes(); + break; + default: reader.skipType(tag & 7); break; @@ -375,6 +416,7 @@ export const Perpetual = { const message = createBasePerpetual(); message.params = object.params !== undefined && object.params !== null ? PerpetualParams.fromPartial(object.params) : undefined; message.fundingIndex = object.fundingIndex ?? new Uint8Array(); + message.openInterest = object.openInterest ?? new Uint8Array(); return message; } @@ -614,7 +656,9 @@ function createBaseLiquidityTier(): LiquidityTier { initialMarginPpm: 0, maintenanceFractionPpm: 0, basePositionNotional: Long.UZERO, - impactNotional: Long.UZERO + impactNotional: Long.UZERO, + openInterestLowerCap: Long.UZERO, + openInterestUpperCap: Long.UZERO }; } @@ -644,6 +688,14 @@ export const LiquidityTier = { writer.uint32(48).uint64(message.impactNotional); } + if (!message.openInterestLowerCap.isZero()) { + writer.uint32(56).uint64(message.openInterestLowerCap); + } + + if (!message.openInterestUpperCap.isZero()) { + writer.uint32(64).uint64(message.openInterestUpperCap); + } + return writer; }, @@ -680,6 +732,14 @@ export const LiquidityTier = { message.impactNotional = (reader.uint64() as Long); break; + case 7: + message.openInterestLowerCap = (reader.uint64() as Long); + break; + + case 8: + message.openInterestUpperCap = (reader.uint64() as Long); + break; + default: reader.skipType(tag & 7); break; @@ -697,6 +757,8 @@ export const LiquidityTier = { message.maintenanceFractionPpm = object.maintenanceFractionPpm ?? 0; message.basePositionNotional = object.basePositionNotional !== undefined && object.basePositionNotional !== null ? Long.fromValue(object.basePositionNotional) : Long.UZERO; message.impactNotional = object.impactNotional !== undefined && object.impactNotional !== null ? Long.fromValue(object.impactNotional) : Long.UZERO; + message.openInterestLowerCap = object.openInterestLowerCap !== undefined && object.openInterestLowerCap !== null ? Long.fromValue(object.openInterestLowerCap) : Long.UZERO; + message.openInterestUpperCap = object.openInterestUpperCap !== undefined && object.openInterestUpperCap !== null ? Long.fromValue(object.openInterestUpperCap) : Long.UZERO; return message; } diff --git a/proto/dydxprotocol/perpetuals/perpetual.proto b/proto/dydxprotocol/perpetuals/perpetual.proto index c58188f0bb..cb5132ea0f 100644 --- a/proto/dydxprotocol/perpetuals/perpetual.proto +++ b/proto/dydxprotocol/perpetuals/perpetual.proto @@ -17,6 +17,13 @@ message Perpetual { "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", (gogoproto.nullable) = false ]; + + // Total size of open long contracts, measured in base_quantums. + bytes open_interest = 3 [ + (gogoproto.customtype) = + "github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt", + (gogoproto.nullable) = false + ]; } enum PerpetualMarketType { @@ -120,4 +127,13 @@ message LiquidityTier { // - Impact ask price = average execution price for a market buy of the // impact notional value. uint64 impact_notional = 6; + + // Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF is not affected when OI <= open_interest_lower_cap. + uint64 open_interest_lower_cap = 7; + + // Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + // If zero, then the IMF does not scale with OI. + uint64 open_interest_upper_cap = 8; } diff --git a/protocol/x/perpetuals/types/perpetual.pb.go b/protocol/x/perpetuals/types/perpetual.pb.go index 6072e4dbea..2325712744 100644 --- a/protocol/x/perpetuals/types/perpetual.pb.go +++ b/protocol/x/perpetuals/types/perpetual.pb.go @@ -62,6 +62,8 @@ type Perpetual struct { // The current index determined by the cumulative all-time // history of the funding mechanism. Starts at zero. FundingIndex github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,2,opt,name=funding_index,json=fundingIndex,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"funding_index"` + // Total size of open long contracts, measured in base_quantums. + OpenInterest github_com_dydxprotocol_v4_chain_protocol_dtypes.SerializableInt `protobuf:"bytes,3,opt,name=open_interest,json=openInterest,proto3,customtype=github.com/dydxprotocol/v4-chain/protocol/dtypes.SerializableInt" json:"open_interest"` } func (m *Perpetual) Reset() { *m = Perpetual{} } @@ -360,6 +362,13 @@ type LiquidityTier struct { // - Impact ask price = average execution price for a market buy of the // impact notional value. ImpactNotional uint64 `protobuf:"varint,6,opt,name=impact_notional,json=impactNotional,proto3" json:"impact_notional,omitempty"` + // Lower cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF is not affected when OI <= open_interest_lower_cap. + OpenInterestLowerCap uint64 `protobuf:"varint,7,opt,name=open_interest_lower_cap,json=openInterestLowerCap,proto3" json:"open_interest_lower_cap,omitempty"` + // Upper cap for Open Interest Margin Fracton (OIMF), in quote quantums. + // IMF scales linearly to 100% as OI approaches open_interest_upper_cap. + // If zero, then the IMF does not scale with OI. + OpenInterestUpperCap uint64 `protobuf:"varint,8,opt,name=open_interest_upper_cap,json=openInterestUpperCap,proto3" json:"open_interest_upper_cap,omitempty"` } func (m *LiquidityTier) Reset() { *m = LiquidityTier{} } @@ -438,6 +447,20 @@ func (m *LiquidityTier) GetImpactNotional() uint64 { return 0 } +func (m *LiquidityTier) GetOpenInterestLowerCap() uint64 { + if m != nil { + return m.OpenInterestLowerCap + } + return 0 +} + +func (m *LiquidityTier) GetOpenInterestUpperCap() uint64 { + if m != nil { + return m.OpenInterestUpperCap + } + return 0 +} + func init() { proto.RegisterEnum("dydxprotocol.perpetuals.PerpetualMarketType", PerpetualMarketType_name, PerpetualMarketType_value) proto.RegisterType((*Perpetual)(nil), "dydxprotocol.perpetuals.Perpetual") @@ -452,51 +475,55 @@ func init() { } var fileDescriptor_ce7204eee10038be = []byte{ - // 696 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x4f, 0xdb, 0x3e, - 0x18, 0xae, 0x4b, 0x7f, 0xfd, 0x81, 0xfb, 0x87, 0xd6, 0x20, 0x16, 0x81, 0x54, 0x4a, 0x25, 0x44, - 0xb5, 0xb1, 0x56, 0x62, 0x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, 0x6b, 0x7a, 0xdb, 0xd0, 0xdb, 0x83, 0xc3, 0xed, - 0x3d, 0xb3, 0xb7, 0x6d, 0xbc, 0x69, 0x0f, 0xcc, 0xc1, 0x3b, 0xbd, 0x6d, 0x1e, 0xee, 0xf7, 0xf5, - 0xf6, 0x4e, 0xb7, 0xd3, 0x6d, 0xef, 0x96, 0x52, 0x68, 0x15, 0xae, 0xdc, 0x4f, 0xdb, 0x31, 0x0e, - 0xfa, 0xfd, 0x12, 0x40, 0x35, 0x58, 0xb9, 0x9f, 0xd0, 0xed, 0x1f, 0xec, 0x6d, 0x0f, 0xda, 0xbb, - 0xa5, 0x74, 0xeb, 0xed, 0xf9, 0x55, 0x05, 0x5c, 0x5c, 0x55, 0xc0, 0xcf, 0xab, 0x0a, 0x38, 0xbb, - 0xae, 0xa4, 0x2e, 0xae, 0x2b, 0xa9, 0xef, 0xd7, 0x95, 0xd4, 0xfb, 0x97, 0xff, 0xfe, 0xf9, 0x9f, - 0x4e, 0x3f, 0x75, 0xf2, 0x29, 0x18, 0x66, 0x25, 0xf8, 0xec, 0x77, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xc6, 0x3a, 0xfc, 0x1e, 0x12, 0x05, 0x00, 0x00, + // 758 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x54, 0xcd, 0x6e, 0xf3, 0x44, + 0x14, 0x8d, 0xdd, 0x10, 0xda, 0xc9, 0xcf, 0x97, 0x4c, 0xab, 0x7e, 0x56, 0x2b, 0xa5, 0x69, 0xa4, + 0xaa, 0x11, 0x94, 0x44, 0x2a, 0x20, 0xb1, 0x60, 0x41, 0x93, 0x26, 0xc2, 0x22, 0x69, 0x2d, 0x27, + 0x45, 0x02, 0x09, 0x8d, 0x26, 0xf6, 0x34, 0x1d, 0xd5, 0x1e, 0x0f, 0xf6, 0x18, 0x1a, 0x76, 0xbc, + 0x41, 0x5f, 0x83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45, + 0x37, 0xf4, 0xc6, 0x4a, 0xab, 0x66, 0x67, 0xef, 0xcd, 0x6b, 0x0d, 0x94, 0x54, 0xaf, 0xb1, 0x08, + 0x42, 0x02, 0x7f, 0x00, 0xeb, 0xd8, 0xf3, 0x90, 0x32, 0x9d, 0xe9, 0xb4, 0xc6, 0x4a, 0xab, 0x78, + 0xb8, 0xff, 0xa6, 0xf1, 0x65, 0x57, 0x2a, 0xbf, 0x35, 0xec, 0x79, 0x2f, 0xed, 0xb2, 0xd8, 0x47, + 0x0b, 0x7e, 0xa4, 0x5d, 0x16, 0xfb, 0x8f, 0x94, 0xe6, 0xdf, 0x3a, 0x28, 0x0f, 0x97, 0x86, 0xf8, + 0x3c, 0x0d, 0x10, 0xe4, 0x19, 0xf6, 0x89, 0xca, 0x82, 0x5c, 0xc3, 0x03, 0x00, 0x29, 0xa3, 0x82, + 0x62, 0xe9, 0x7d, 0x46, 0x99, 0xfc, 0x7c, 0x69, 0x24, 0xaa, 0x0a, 0x19, 0x49, 0x20, 0xf9, 0x7a, + 0x5f, 0x00, 0xc3, 0xc7, 0x49, 0xbe, 0x19, 0x66, 0x0e, 0x41, 0xe7, 0x21, 0x76, 0x92, 0x14, 0x48, + 0x4d, 0x5e, 0x6a, 0x36, 0x17, 0xf0, 0x81, 0x82, 0x53, 0xe5, 0xe6, 0x14, 0x47, 0x04, 0xf1, 0x20, + 0xa2, 0x52, 0xc2, 0x82, 0xe4, 0x81, 0x3d, 0x19, 0x95, 0x7c, 0x57, 0x37, 0x34, 0x7b, 0x23, 0x61, + 0x58, 0x8a, 0x70, 0xa2, 0x70, 0xb8, 0x0f, 0xde, 0x51, 0x9f, 0x63, 0x47, 0x3c, 0x49, 0x92, 0xc8, + 0xe4, 0xed, 0x4a, 0x5a, 0xce, 0x88, 0x9f, 0x83, 0xf7, 0x4b, 0xff, 0x1f, 0xf2, 0x82, 0x9f, 0x49, + 0x88, 0x1c, 0xcc, 0x65, 0x7e, 0xf2, 0xf6, 0xc6, 0xe2, 0xff, 0x33, 0x4c, 0xc0, 0x1e, 0xe6, 0x2f, + 0x65, 0x31, 0xe7, 0x4a, 0xb6, 0xfa, 0x52, 0x76, 0x96, 0x80, 0x3d, 0xcc, 0x3f, 0xfa, 0x55, 0x03, + 0xeb, 0xaf, 0xc4, 0x0e, 0xee, 0x81, 0x5d, 0xab, 0x6f, 0x5b, 0xfd, 0xc9, 0xd9, 0xd1, 0x10, 0x8d, + 0x8e, 0xec, 0x6f, 0xfa, 0x13, 0x34, 0xf9, 0xce, 0xea, 0xa3, 0xb3, 0x93, 0xb1, 0xd5, 0xef, 0x99, + 0x03, 0xb3, 0x7f, 0x5c, 0xcd, 0xc1, 0x1d, 0xb0, 0xfd, 0x3a, 0xad, 0x67, 0x9f, 0x8e, 0xc7, 0x55, + 0x0d, 0x36, 0x41, 0xfd, 0x75, 0x82, 0x39, 0x3e, 0x1d, 0x1e, 0x4d, 0xfa, 0xc7, 0x55, 0xbd, 0xfb, + 0xed, 0xcd, 0x7d, 0x5d, 0xbb, 0xbd, 0xaf, 0x6b, 0x7f, 0xdd, 0xd7, 0xb5, 0xeb, 0x87, 0x7a, 0xee, + 0xf6, 0xa1, 0x9e, 0xfb, 0xe3, 0xa1, 0x9e, 0xfb, 0xfe, 0xcb, 0xff, 0x7e, 0xd9, 0x5c, 0x2d, 0xde, + 0xe3, 0xf2, 0xe2, 0x99, 0x16, 0x24, 0xf8, 0xe9, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7d, 0x28, + 0x1e, 0x85, 0xef, 0x05, 0x00, 0x00, } func (m *Perpetual) Marshal() (dAtA []byte, err error) { @@ -519,6 +546,16 @@ func (m *Perpetual) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.OpenInterest.Size() + i -= size + if _, err := m.OpenInterest.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintPerpetual(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a { size := m.FundingIndex.Size() i -= size @@ -711,6 +748,16 @@ func (m *LiquidityTier) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.OpenInterestUpperCap != 0 { + i = encodeVarintPerpetual(dAtA, i, uint64(m.OpenInterestUpperCap)) + i-- + dAtA[i] = 0x40 + } + if m.OpenInterestLowerCap != 0 { + i = encodeVarintPerpetual(dAtA, i, uint64(m.OpenInterestLowerCap)) + i-- + dAtA[i] = 0x38 + } if m.ImpactNotional != 0 { i = encodeVarintPerpetual(dAtA, i, uint64(m.ImpactNotional)) i-- @@ -767,6 +814,8 @@ func (m *Perpetual) Size() (n int) { n += 1 + l + sovPerpetual(uint64(l)) l = m.FundingIndex.Size() n += 1 + l + sovPerpetual(uint64(l)) + l = m.OpenInterest.Size() + n += 1 + l + sovPerpetual(uint64(l)) return n } @@ -863,6 +912,12 @@ func (m *LiquidityTier) Size() (n int) { if m.ImpactNotional != 0 { n += 1 + sovPerpetual(uint64(m.ImpactNotional)) } + if m.OpenInterestLowerCap != 0 { + n += 1 + sovPerpetual(uint64(m.OpenInterestLowerCap)) + } + if m.OpenInterestUpperCap != 0 { + n += 1 + sovPerpetual(uint64(m.OpenInterestUpperCap)) + } return n } @@ -967,6 +1022,39 @@ func (m *Perpetual) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenInterest", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetual + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthPerpetual + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthPerpetual + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.OpenInterest.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipPerpetual(dAtA[iNdEx:]) @@ -1594,6 +1682,44 @@ func (m *LiquidityTier) Unmarshal(dAtA []byte) error { break } } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenInterestLowerCap", wireType) + } + m.OpenInterestLowerCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetual + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OpenInterestLowerCap |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field OpenInterestUpperCap", wireType) + } + m.OpenInterestUpperCap = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowPerpetual + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.OpenInterestUpperCap |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipPerpetual(dAtA[iNdEx:])