diff --git a/indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts b/indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts index 4de55fd505..b262a362c8 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/indexer/events/events.ts @@ -943,8 +943,12 @@ export interface LiquidityTierUpsertEventV1 { * The maximum position size at which the margin requirements are * not increased over the default values. Above this position size, * the margin requirements increase at a rate of sqrt(size). + * + * Deprecated since v3.x. */ + /** @deprecated */ + basePositionNotional: Long; } /** @@ -974,8 +978,12 @@ export interface LiquidityTierUpsertEventV1SDKType { * The maximum position size at which the margin requirements are * not increased over the default values. Above this position size, * the margin requirements increase at a rate of sqrt(size). + * + * Deprecated since v3.x. */ + /** @deprecated */ + base_position_notional: Long; } /** 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 f4947e6c05..2408940f66 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts @@ -198,8 +198,12 @@ export interface LiquidityTier { * The maximum position size at which the margin requirements are * not increased over the default values. Above this position size, * the margin requirements increase at a rate of sqrt(size). + * + * Deprecated since v3.x. */ + /** @deprecated */ + basePositionNotional: Long; /** * The impact notional amount (in quote quantums) is used to determine impact @@ -237,8 +241,12 @@ export interface LiquidityTierSDKType { * The maximum position size at which the margin requirements are * not increased over the default values. Above this position size, * the margin requirements increase at a rate of sqrt(size). + * + * Deprecated since v3.x. */ + /** @deprecated */ + base_position_notional: Long; /** * The impact notional amount (in quote quantums) is used to determine impact diff --git a/proto/dydxprotocol/indexer/events/events.proto b/proto/dydxprotocol/indexer/events/events.proto index bdbed11fe6..a58268e2f2 100644 --- a/proto/dydxprotocol/indexer/events/events.proto +++ b/proto/dydxprotocol/indexer/events/events.proto @@ -374,7 +374,9 @@ message LiquidityTierUpsertEventV1 { // The maximum position size at which the margin requirements are // not increased over the default values. Above this position size, // the margin requirements increase at a rate of sqrt(size). - uint64 base_position_notional = 5; + // + // Deprecated since v3.x. + uint64 base_position_notional = 5 [ deprecated = true ]; } // UpdateClobPairEventV1 message contains all the information about an update to diff --git a/proto/dydxprotocol/perpetuals/perpetual.proto b/proto/dydxprotocol/perpetuals/perpetual.proto index 5f79acd6b9..fd8e8390c4 100644 --- a/proto/dydxprotocol/perpetuals/perpetual.proto +++ b/proto/dydxprotocol/perpetuals/perpetual.proto @@ -96,7 +96,9 @@ message LiquidityTier { // The maximum position size at which the margin requirements are // not increased over the default values. Above this position size, // the margin requirements increase at a rate of sqrt(size). - uint64 base_position_notional = 5; + // + // Deprecated since v3.x. + uint64 base_position_notional = 5 [ deprecated = true ]; // The impact notional amount (in quote quantums) is used to determine impact // bid/ask prices and its recommended value is 500 USDC / initial margin diff --git a/protocol/indexer/events/events.pb.go b/protocol/indexer/events/events.pb.go index 079b3b6091..ed087d557b 100644 --- a/protocol/indexer/events/events.pb.go +++ b/protocol/indexer/events/events.pb.go @@ -1751,7 +1751,9 @@ type LiquidityTierUpsertEventV1 struct { // The maximum position size at which the margin requirements are // not increased over the default values. Above this position size, // the margin requirements increase at a rate of sqrt(size). - BasePositionNotional uint64 `protobuf:"varint,5,opt,name=base_position_notional,json=basePositionNotional,proto3" json:"base_position_notional,omitempty"` + // + // Deprecated since v3.x. + BasePositionNotional uint64 `protobuf:"varint,5,opt,name=base_position_notional,json=basePositionNotional,proto3" json:"base_position_notional,omitempty"` // Deprecated: Do not use. } func (m *LiquidityTierUpsertEventV1) Reset() { *m = LiquidityTierUpsertEventV1{} } @@ -1815,6 +1817,7 @@ func (m *LiquidityTierUpsertEventV1) GetMaintenanceFractionPpm() uint32 { return 0 } +// Deprecated: Do not use. func (m *LiquidityTierUpsertEventV1) GetBasePositionNotional() uint64 { if m != nil { return m.BasePositionNotional @@ -2136,137 +2139,137 @@ func init() { } var fileDescriptor_6331dfb59c6fd2bb = []byte{ - // 2071 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xbd, 0x6f, 0x1b, 0xc9, - 0x15, 0x17, 0x3f, 0x44, 0x49, 0x8f, 0xa2, 0x4c, 0x8e, 0x25, 0x99, 0x92, 0x12, 0xd9, 0x59, 0x20, - 0x80, 0x71, 0x1f, 0x94, 0xe5, 0x38, 0xc1, 0x21, 0x45, 0x10, 0x51, 0xa2, 0x4e, 0x34, 0x2c, 0x99, - 0x59, 0x52, 0xbe, 0x3b, 0x27, 0xb8, 0xcd, 0x68, 0x77, 0x48, 0x0d, 0xb4, 0x5f, 0xb7, 0x33, 0x94, - 0x2d, 0x03, 0xa9, 0x93, 0x2e, 0x01, 0x52, 0xa5, 0x48, 0x91, 0x22, 0x4d, 0x80, 0x14, 0x01, 0xd2, - 0x5e, 0x95, 0xe6, 0xba, 0x1c, 0xd2, 0x24, 0x48, 0x61, 0x04, 0x76, 0x91, 0x36, 0x7f, 0x42, 0x30, - 0x1f, 0xbb, 0x24, 0xc5, 0x0f, 0xd3, 0x96, 0xae, 0x12, 0xe7, 0xbd, 0x79, 0xbf, 0xf7, 0x39, 0xf3, - 0xde, 0xac, 0xe0, 0xae, 0x73, 0xe1, 0x3c, 0x0f, 0xa3, 0x80, 0x07, 0x76, 0xe0, 0x6e, 0x51, 0xdf, - 0x21, 0xcf, 0x49, 0xb4, 0x45, 0xce, 0x89, 0xcf, 0x99, 0xfe, 0x53, 0x91, 0x6c, 0xb4, 0xd1, 0xbf, - 0xb3, 0xa2, 0x77, 0x56, 0xd4, 0x96, 0xf5, 0x35, 0x3b, 0x60, 0x5e, 0xc0, 0x2c, 0xc9, 0xdf, 0x52, - 0x0b, 0x25, 0xb7, 0xbe, 0xdc, 0x09, 0x3a, 0x81, 0x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0x8a, 0x07, 0x5a, 0xf0, 0xcc, 0x27, 0xf1, 0x57, 0x40, 0xb5, 0x40, 0x67, 0xb0, - 0xe8, 0x10, 0x3f, 0xf0, 0xe2, 0x87, 0x5d, 0xfa, 0x9a, 0xbf, 0xa2, 0xe7, 0x25, 0xba, 0x7a, 0x23, - 0x56, 0xcd, 0xaf, 0x5e, 0x6d, 0xa6, 0xbe, 0x7e, 0xb5, 0x99, 0xfa, 0xcf, 0xab, 0xcd, 0xd4, 0x6f, - 0x5e, 0x6f, 0xce, 0x7c, 0xfd, 0x7a, 0x73, 0xe6, 0x5f, 0xaf, 0x37, 0x67, 0x9e, 0x7e, 0x34, 0xbd, - 0xa2, 0xc1, 0xff, 0xab, 0x9c, 0xe4, 0x24, 0xe3, 0x7b, 0xff, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xa1, - 0x62, 0x23, 0xbf, 0x7d, 0x19, 0x00, 0x00, + // 2074 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x59, 0xcd, 0x6f, 0x23, 0x49, + 0x15, 0x4f, 0xdb, 0x8e, 0xe3, 0x3c, 0xc7, 0x19, 0xbb, 0x26, 0xc9, 0x38, 0x09, 0x64, 0x42, 0x4b, + 0x48, 0xd1, 0x7e, 0x38, 0x93, 0x61, 0x41, 0x2b, 0x0e, 0x88, 0x38, 0x71, 0x36, 0x1e, 0x25, 0x19, + 0xd3, 0x76, 0x66, 0x77, 0x07, 0xb4, 0x4d, 0xa5, 0xbb, 0xec, 0x94, 0xd2, 0x5f, 0xdb, 0xd5, 0xce, + 0x4c, 0x46, 0xe2, 0x0c, 0x37, 0x90, 0x38, 0x71, 0xe0, 0xc0, 0x81, 0x0b, 0x12, 0x07, 0x24, 0xae, + 0x7b, 0xe2, 0xb2, 0x37, 0x56, 0x5c, 0x40, 0x1c, 0x56, 0x68, 0xe6, 0xc0, 0x95, 0x3f, 0x01, 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0x58, 0x17, 0x8c, 0x83, 0xd3, 0x93, 0xfd, + 0xfa, 0xc9, 0x47, 0xa6, 0xb1, 0xdb, 0xaa, 0x99, 0xbb, 0x27, 0xfb, 0x66, 0xfd, 0x64, 0xbf, 0xf6, + 0x49, 0x31, 0x85, 0x96, 0xa1, 0x34, 0x20, 0xf9, 0xe4, 0x71, 0xab, 0x56, 0x4c, 0xeb, 0x7f, 0x4b, + 0x41, 0xe1, 0x18, 0x87, 0x17, 0x24, 0x8a, 0x83, 0xb2, 0x0e, 0xf3, 0xae, 0x20, 0xf4, 0x52, 0x9c, + 0x93, 0x84, 0xba, 0x8d, 0x9e, 0xc2, 0x42, 0x10, 0x52, 0x8b, 0x98, 0xd2, 0x69, 0xe1, 0x6b, 0xfe, + 0xe1, 0xf7, 0x27, 0xfa, 0x2a, 0xe1, 0x1b, 0x5c, 0x4c, 0x86, 0x4e, 0x69, 0x3a, 0x9c, 0x31, 0xf2, + 0x41, 0x8f, 0x8a, 0x3e, 0x86, 0x82, 0x52, 0x6c, 0x85, 0x84, 0x83, 0xa7, 0x05, 0xf8, 0x83, 0x29, + 0xc0, 0xf7, 0x84, 0x40, 0x0f, 0x77, 0xc1, 0xed, 0x23, 0xf7, 0x01, 0xbb, 0xbe, 0x4d, 0xdb, 0x57, + 0xe5, 0xcc, 0xd4, 0xc0, 0xc7, 0x42, 0x60, 0x08, 0x58, 0x92, 0xab, 0x73, 0x30, 0x2b, 0x76, 0xeb, + 0x8f, 0xa0, 0x3c, 0xce, 0x4b, 0x54, 0x81, 0xbb, 0x32, 0x64, 0xcf, 0x68, 0x74, 0x6e, 0x92, 0xe7, + 0x81, 0xef, 0x11, 0x2f, 0x12, 0x91, 0xcd, 0x18, 0x25, 0xc1, 0xfa, 0x98, 0x46, 0xe7, 0x35, 0xc5, + 0xd0, 0x3f, 0x81, 0x92, 0xc4, 0xaa, 0x62, 0x96, 0x80, 0x20, 0xc8, 0x04, 0x98, 0x86, 0x42, 0x6a, + 0xde, 0x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c, 0x0f, 0x50, 0xe4, 0x47, 0xd8, 0x31, 0x39, 0x1a, 0xb1, 0x4d, 0x21, 0x55, 0x9e, 0x13, 0x1a, + 0x8a, 0x82, 0x73, 0x20, 0x18, 0xc7, 0x9c, 0x3e, 0xb4, 0x5b, 0xc0, 0x94, 0x73, 0x43, 0xbb, 0x5b, + 0x9c, 0x5e, 0x2d, 0x40, 0x3e, 0xea, 0x65, 0x4d, 0xff, 0x5f, 0x0a, 0xee, 0xee, 0x13, 0x87, 0x5c, + 0x92, 0x10, 0x77, 0xfa, 0xe6, 0x81, 0x9f, 0x02, 0xc4, 0x1e, 0x93, 0x9b, 0x1d, 0xc0, 0x38, 0xc5, + 0x3d, 0x38, 0x0e, 0xee, 0xb7, 0xdb, 0x8c, 0x44, 0x11, 0xf5, 0x3a, 0x37, 0x3a, 0x71, 0x31, 0x78, + 0x0f, 0x6e, 0x68, 0x34, 0x4b, 0x0f, 0x8f, 0x66, 0xd7, 0x52, 0x97, 0x19, 0x4a, 0xdd, 0x12, 0xcc, + 0x8a, 0x5e, 0x22, 0xd2, 0x96, 0x31, 0xe4, 0x02, 0x2d, 0x43, 0x96, 0x32, 0xf3, 0xac, 0x7b, 0x25, + 0x12, 0x96, 0x33, 0x66, 0x29, 0xab, 0x76, 0xaf, 0x78, 0x57, 0xa3, 0xcc, 0x6c, 0x53, 0x0f, 0x3b, + 0x26, 0x37, 0xc2, 0x21, 0x2e, 0x3f, 0x70, 0x73, 0x62, 0x4f, 0x89, 0xb2, 0x03, 0xce, 0x69, 0x26, + 0x0c, 0xfd, 0x57, 0x29, 0x40, 0xc3, 0x35, 0xf6, 0xcd, 0x46, 0x7c, 0x13, 0x16, 0xf8, 0x10, 0x6c, + 0xf2, 0x6e, 0x19, 0xdf, 0x72, 0x05, 0x03, 0x38, 0xad, 0x81, 0x69, 0x58, 0xb7, 0xa7, 0x09, 0xdb, + 0xb7, 0x01, 0x64, 0xa1, 0x31, 0xfa, 0x82, 0xa8, 0xa8, 0x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3, 0x93, 0x1c, 0xe5, 0x09, 0x17, 0x8e, 0x3a, 0x9c, 0xa9, 0xf1, 0x87, 0x33, 0x3d, 0xcd, 0x8d, + 0x92, 0x19, 0x73, 0x24, 0x86, 0x0b, 0x77, 0x76, 0x54, 0xe1, 0x32, 0x58, 0x6e, 0x85, 0xd8, 0xa6, + 0x5e, 0xc7, 0x20, 0xcf, 0x70, 0x68, 0xb3, 0xde, 0xac, 0x7e, 0x27, 0x92, 0x0c, 0x33, 0x94, 0x1c, + 0xf5, 0x15, 0x79, 0x67, 0xe2, 0xd4, 0xa0, 0x3e, 0x13, 0x0d, 0x60, 0x1a, 0x8b, 0xd1, 0x80, 0x0a, + 0xfd, 0x77, 0x1a, 0x2c, 0x8d, 0xda, 0xc8, 0x1f, 0x69, 0xfe, 0x33, 0x8f, 0xc4, 0x5f, 0x02, 0xe5, + 0x02, 0x5d, 0xc0, 0x82, 0x4d, 0x3c, 0xdf, 0x8d, 0x1f, 0x77, 0xa9, 0x5b, 0xfe, 0x92, 0x9e, 0x17, + 0xe8, 0xf2, 0x9d, 0x58, 0x35, 0xbe, 0x7c, 0xb9, 0xa1, 0x7d, 0xf5, 0x72, 0x43, 0xfb, 0xcf, 0xcb, + 0x0d, 0xed, 0x37, 0xaf, 0x36, 0x66, 0xbe, 0x7a, 0xb5, 0x31, 0xf3, 0xaf, 0x57, 0x1b, 0x33, 0x4f, + 0x3f, 0x9c, 0x5e, 0xd1, 0xe0, 0xff, 0x56, 0xce, 0xb2, 0x82, 0xf1, 0xbd, 0xff, 0x07, 0x00, 0x00, + 0xff, 0xff, 0x28, 0x91, 0x43, 0x7f, 0x81, 0x19, 0x00, 0x00, } func (m *FundingUpdateV1) Marshal() (dAtA []byte, err error) { diff --git a/protocol/indexer/events/liquidity_tier.go b/protocol/indexer/events/liquidity_tier.go index 43d86cde97..14b77c754f 100644 --- a/protocol/indexer/events/liquidity_tier.go +++ b/protocol/indexer/events/liquidity_tier.go @@ -7,13 +7,11 @@ func NewLiquidityTierUpsertEvent( name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, - basePositionNotional uint64, ) *LiquidityTierUpsertEventV1 { return &LiquidityTierUpsertEventV1{ Id: id, Name: name, InitialMarginPpm: initialMarginPpm, MaintenanceFractionPpm: maintenanceFractionPpm, - BasePositionNotional: basePositionNotional, } } diff --git a/protocol/indexer/events/liquidity_tier_test.go b/protocol/indexer/events/liquidity_tier_test.go index 305e890a4e..64e1718392 100644 --- a/protocol/indexer/events/liquidity_tier_test.go +++ b/protocol/indexer/events/liquidity_tier_test.go @@ -12,14 +12,12 @@ func TestNewLiquidityTierUpsertEvent_Success(t *testing.T) { "Large-Cap", 50000, 600000, - 1000000000000, ) expectedLiquidityTierUpsertEventProto := &LiquidityTierUpsertEventV1{ Id: 0, Name: "Large-Cap", InitialMarginPpm: 50000, MaintenanceFractionPpm: 600000, - BasePositionNotional: 1000000000000, } require.Equal(t, expectedLiquidityTierUpsertEventProto, liquidityTierUpsertEvent) } diff --git a/protocol/mocks/PerpetualsKeeper.go b/protocol/mocks/PerpetualsKeeper.go index f8c22c387c..ca2b84212d 100644 --- a/protocol/mocks/PerpetualsKeeper.go +++ b/protocol/mocks/PerpetualsKeeper.go @@ -227,20 +227,20 @@ func (_m *PerpetualsKeeper) PerformStatefulPremiumVotesValidation(ctx types.Cont return r0 } -// SetLiquidityTier provides a mock function with given fields: ctx, id, name, initialMarginPpm, maintenanceFractionPpm, basePositionNotional, impactNotional -func (_m *PerpetualsKeeper) SetLiquidityTier(ctx types.Context, id uint32, name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, basePositionNotional uint64, impactNotional uint64) (perpetualstypes.LiquidityTier, error) { - ret := _m.Called(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, basePositionNotional, impactNotional) +// SetLiquidityTier provides a mock function with given fields: ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional +func (_m *PerpetualsKeeper) SetLiquidityTier(ctx types.Context, id uint32, name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, impactNotional uint64) (perpetualstypes.LiquidityTier, error) { + ret := _m.Called(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) var r0 perpetualstypes.LiquidityTier - if rf, ok := ret.Get(0).(func(types.Context, uint32, string, uint32, uint32, uint64, uint64) perpetualstypes.LiquidityTier); ok { - r0 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, basePositionNotional, impactNotional) + if rf, ok := ret.Get(0).(func(types.Context, uint32, string, uint32, uint32, uint64) perpetualstypes.LiquidityTier); ok { + r0 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) } else { r0 = ret.Get(0).(perpetualstypes.LiquidityTier) } var r1 error - if rf, ok := ret.Get(1).(func(types.Context, uint32, string, uint32, uint32, uint64, uint64) error); ok { - r1 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, basePositionNotional, impactNotional) + if rf, ok := ret.Get(1).(func(types.Context, uint32, string, uint32, uint32, uint64) error); ok { + r1 = rf(ctx, id, name, initialMarginPpm, maintenanceFractionPpm, impactNotional) } else { r1 = ret.Error(1) } diff --git a/protocol/testing/e2e/gov/perpetuals_test.go b/protocol/testing/e2e/gov/perpetuals_test.go index 1ac90df2c2..e2286a5301 100644 --- a/protocol/testing/e2e/gov/perpetuals_test.go +++ b/protocol/testing/e2e/gov/perpetuals_test.go @@ -31,7 +31,6 @@ var ( Name: "Test Tier", InitialMarginPpm: 765_432, MaintenanceFractionPpm: 345_678, - BasePositionNotional: 123_456, ImpactNotional: 654_321, } ) @@ -355,7 +354,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: TEST_LIQUIDITY_TIER.Name, InitialMarginPpm: TEST_LIQUIDITY_TIER.InitialMarginPpm, MaintenanceFractionPpm: TEST_LIQUIDITY_TIER.MaintenanceFractionPpm, - BasePositionNotional: TEST_LIQUIDITY_TIER.BasePositionNotional, ImpactNotional: TEST_LIQUIDITY_TIER.ImpactNotional, }, }, @@ -369,7 +367,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: TEST_LIQUIDITY_TIER.Name, InitialMarginPpm: TEST_LIQUIDITY_TIER.InitialMarginPpm, MaintenanceFractionPpm: TEST_LIQUIDITY_TIER.MaintenanceFractionPpm, - BasePositionNotional: TEST_LIQUIDITY_TIER.BasePositionNotional, ImpactNotional: TEST_LIQUIDITY_TIER.ImpactNotional, }, }, @@ -384,7 +381,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: TEST_LIQUIDITY_TIER.Name, InitialMarginPpm: 1_000_001, MaintenanceFractionPpm: TEST_LIQUIDITY_TIER.MaintenanceFractionPpm, - BasePositionNotional: TEST_LIQUIDITY_TIER.BasePositionNotional, ImpactNotional: TEST_LIQUIDITY_TIER.ImpactNotional, }, }, @@ -398,21 +394,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: TEST_LIQUIDITY_TIER.Name, InitialMarginPpm: TEST_LIQUIDITY_TIER.InitialMarginPpm, MaintenanceFractionPpm: 1_000_001, - BasePositionNotional: TEST_LIQUIDITY_TIER.BasePositionNotional, - ImpactNotional: TEST_LIQUIDITY_TIER.ImpactNotional, - }, - }, - expectCheckTxFails: true, - }, - "Failure: base position notional is 0": { - msg: &perptypes.MsgSetLiquidityTier{ - Authority: authtypes.NewModuleAddress(perptypes.ModuleName).String(), - LiquidityTier: perptypes.LiquidityTier{ - Id: 5678, - Name: TEST_LIQUIDITY_TIER.Name, - InitialMarginPpm: TEST_LIQUIDITY_TIER.InitialMarginPpm, - MaintenanceFractionPpm: TEST_LIQUIDITY_TIER.MaintenanceFractionPpm, - BasePositionNotional: 0, ImpactNotional: TEST_LIQUIDITY_TIER.ImpactNotional, }, }, @@ -426,7 +407,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: TEST_LIQUIDITY_TIER.Name, InitialMarginPpm: TEST_LIQUIDITY_TIER.InitialMarginPpm, MaintenanceFractionPpm: TEST_LIQUIDITY_TIER.MaintenanceFractionPpm, - BasePositionNotional: TEST_LIQUIDITY_TIER.BasePositionNotional, ImpactNotional: 0, }, }, @@ -440,7 +420,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "Test Tier", InitialMarginPpm: 765_432, MaintenanceFractionPpm: 345_678, - BasePositionNotional: 123_456, ImpactNotional: 654_321, }, }, diff --git a/protocol/testutil/constants/perpetuals.go b/protocol/testutil/constants/perpetuals.go index 21b17dbe41..ccf11f1189 100644 --- a/protocol/testutil/constants/perpetuals.go +++ b/protocol/testutil/constants/perpetuals.go @@ -23,7 +23,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "0", InitialMarginPpm: 1_000_000, MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 1_000_000, ImpactNotional: 500_000_000, }, { @@ -31,7 +30,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "1", InitialMarginPpm: 1_000_000, MaintenanceFractionPpm: 750_000, - BasePositionNotional: 1_000_000, ImpactNotional: 500_000_000, }, { @@ -39,7 +37,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "2", InitialMarginPpm: 1_000_000, MaintenanceFractionPpm: 0, - BasePositionNotional: 1_000_000, ImpactNotional: 500_000_000, }, { @@ -47,7 +44,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "3", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 500_000, - BasePositionNotional: 100_000_000_000, ImpactNotional: 2_500_000_000, }, { @@ -55,7 +51,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "4", InitialMarginPpm: 500_000, MaintenanceFractionPpm: 800_000, - BasePositionNotional: 100_000_000_000, ImpactNotional: 1_000_000_000, }, { @@ -63,7 +58,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "5", InitialMarginPpm: 500_000, MaintenanceFractionPpm: 600_000, - BasePositionNotional: 1_000_000, ImpactNotional: 1_000_000_000, }, { @@ -71,7 +65,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "6", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 900_000, - BasePositionNotional: 1_000_000, ImpactNotional: 2_500_000_000, }, { @@ -79,7 +72,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "7", InitialMarginPpm: 0, MaintenanceFractionPpm: 0, - BasePositionNotional: 100_000_000_000, ImpactNotional: 1_000_000_000, }, { @@ -87,7 +79,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "8", InitialMarginPpm: 9_910, // 0.9910% MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 100_000_000_000, ImpactNotional: 50_454_000_000, }, { @@ -95,7 +86,6 @@ var LiquidityTiers = []perptypes.LiquidityTier{ Name: "101", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 500_000, - BasePositionNotional: 1_000_000, ImpactNotional: 2_500_000_000, }, } @@ -331,7 +321,6 @@ var ( Name: "Large-Cap", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 500_000, - BasePositionNotional: 1000_000_000, ImpactNotional: 2_500_000_000, }, { @@ -339,7 +328,6 @@ var ( Name: "Mid-Cap", InitialMarginPpm: 300_000, MaintenanceFractionPpm: 600_000, - BasePositionNotional: 500_000_000, ImpactNotional: 1_667_000_000, }, { @@ -347,7 +335,6 @@ var ( Name: "Small-Cap", InitialMarginPpm: 400_000, MaintenanceFractionPpm: 700_000, - BasePositionNotional: 250_000_000, ImpactNotional: 1_250_000_000, }, }, diff --git a/protocol/testutil/keeper/perpetuals.go b/protocol/testutil/keeper/perpetuals.go index 35eeecfd1a..23a77efd8a 100644 --- a/protocol/testutil/keeper/perpetuals.go +++ b/protocol/testutil/keeper/perpetuals.go @@ -2,9 +2,10 @@ package keeper import ( "fmt" - "github.com/dydxprotocol/v4-chain/protocol/lib" "testing" + "github.com/dydxprotocol/v4-chain/protocol/lib" + pricefeedserver_types "github.com/dydxprotocol/v4-chain/protocol/daemons/server/types/pricefeed" "github.com/dydxprotocol/v4-chain/protocol/indexer/common" indexerevents "github.com/dydxprotocol/v4-chain/protocol/indexer/events" @@ -174,7 +175,6 @@ func CreateTestLiquidityTiers(t *testing.T, ctx sdk.Context, k *keeper.Keeper) { l.Name, l.InitialMarginPpm, l.MaintenanceFractionPpm, - l.BasePositionNotional, l.ImpactNotional, ) diff --git a/protocol/testutil/liquidity_tier/liquidity_tier.go b/protocol/testutil/liquidity_tier/liquidity_tier.go index 66753b7bd2..77989d5b2d 100644 --- a/protocol/testutil/liquidity_tier/liquidity_tier.go +++ b/protocol/testutil/liquidity_tier/liquidity_tier.go @@ -30,12 +30,6 @@ func WithMaintenanceFractionPpm(maintenanceFractionPpm uint32) LtModifierOption } } -func WithBasePositionNotional(basePositionNotional uint64) LtModifierOption { - return func(lt *perptypes.LiquidityTier) { - lt.BasePositionNotional = basePositionNotional - } -} - func WithImpactNotional(impactNotional uint64) LtModifierOption { return func(lt *perptypes.LiquidityTier) { lt.ImpactNotional = impactNotional @@ -57,7 +51,6 @@ func GenerateLiquidityTier(optionalModifications ...LtModifierOption) *perptypes Name: "Large-Cap", InitialMarginPpm: 1_000_000, MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 1_000_000, ImpactNotional: 500_000_000, } diff --git a/protocol/testutil/sim_helpers/genesis_parameters.go b/protocol/testutil/sim_helpers/genesis_parameters.go index ac2f950078..e27a26469a 100644 --- a/protocol/testutil/sim_helpers/genesis_parameters.go +++ b/protocol/testutil/sim_helpers/genesis_parameters.go @@ -133,15 +133,6 @@ var ( Valid: MaxNumPerpetuals.Valid, } - MinBasePositionNotional = GenesisParameters[int]{ - Reasonable: 10_000_000_000, // 10_000 USDC - Valid: 50_000_000_000, // 50_000 USDC - } - MaxBasePositionNotional = GenesisParameters[int]{ - Reasonable: MinBasePositionNotional.Reasonable * 100, - Valid: MinBasePositionNotional.Valid * 100, - } - MinFundingRateClampFactorPpm = GenesisParameters[int]{ Reasonable: 4_000_000, // 400% Valid: 1_000_000, // 100% diff --git a/protocol/x/clob/e2e/liquidation_deleveraging_test.go b/protocol/x/clob/e2e/liquidation_deleveraging_test.go index 6d67a3510f..d5aa68d78d 100644 --- a/protocol/x/clob/e2e/liquidation_deleveraging_test.go +++ b/protocol/x/clob/e2e/liquidation_deleveraging_test.go @@ -694,134 +694,6 @@ func TestPlacePerpetualLiquidation_Deleveraging(t *testing.T) { }, }, }, - `Can place and match liquidation order for subaccount with non-linear margin requirement`: { - liquidityTiers: []perptypes.LiquidityTier{ - { - Id: 3, - Name: "3", - InitialMarginPpm: 200_000, // 20% IMF - MaintenanceFractionPpm: 500_000, // 10% MMF - BasePositionNotional: 12_500_000_000, // $12.5k - ImpactNotional: 2_500_000_000, - }, - }, - perpetuals: []perptypes.Perpetual{ - // Uses liquidity tier id 3 - constants.BtcUsd_20PercentInitial_10PercentMaintenance, - }, - subaccounts: []satypes.Subaccount{ - // When below basePositionNotional, marginAdjustmentPpm is 1e^6 but at 1 BTC is 1e^6 * sqrt(50k/12.25k) = 2e^6 - // This means maintenanceMarginPpm is 1e^5 * 2 = 2e^5. Maintenance margin is now 20%. - // A subaccount with a 1 BTC position must then have .20*50k = $10k in TNC to be well collateralized. - { // TNC = $9,999, undercollateralized - Id: &constants.Carl_Num0, - AssetPositions: []*satypes.AssetPosition{ - { - AssetId: 0, - Quantums: dtypes.NewInt(-40_001_000_000), // $-40,001 - }, - }, - PerpetualPositions: []*satypes.PerpetualPosition{ - { - PerpetualId: 0, - Quantums: dtypes.NewInt(100_000_000), // 1 BTC - }, - }, - }, - constants.Dave_Num0_1BTC_Long_50000USD, - }, - placedMatchableOrders: []clobtypes.MatchableOrder{ - &constants.LongTermOrder_Dave_Num0_Id0_Clob0_Buy1BTC_Price50000_GTBT10, - }, - liquidatableSubaccountIds: []satypes.SubaccountId{constants.Carl_Num0}, - liquidationConfig: constants.LiquidationsConfig_FillablePrice_Max_Smmr, - clobPairs: []clobtypes.ClobPair{constants.ClobPair_Btc}, - - expectedSubaccounts: []satypes.Subaccount{ - { - Id: &constants.Carl_Num0, - AssetPositions: []*satypes.AssetPosition{ - { - AssetId: 0, - // Asset position + fill price - liquidation insurance fund fee - Quantums: dtypes.NewInt(-40_001_000_000 + 50_000_000_000 - 250_000_000), - }, - }, - }, - { - Id: &constants.Dave_Num0, - PerpetualPositions: []*satypes.PerpetualPosition{ - { - PerpetualId: 0, - Quantums: dtypes.NewInt(200_000_000), - FundingIndex: dtypes.NewInt(0), - }, - }, - }, - }, - }, - `Skip liquidating subaccount when TNC equals MMR with non-linear margin requirement`: { - liquidityTiers: []perptypes.LiquidityTier{ - { - Id: 3, - Name: "3", - InitialMarginPpm: 200_000, // 20% IMF - MaintenanceFractionPpm: 500_000, // 10% MMF - BasePositionNotional: 12_500_000_000, // $12.5k - ImpactNotional: 2_500_000_000, - }, - }, - perpetuals: []perptypes.Perpetual{ - // Uses liquidity tier id 3 - constants.BtcUsd_20PercentInitial_10PercentMaintenance, - }, - subaccounts: []satypes.Subaccount{ - { // TNC = $10k, MMR = $10k - Id: &constants.Carl_Num0, - AssetPositions: []*satypes.AssetPosition{ - { - AssetId: 0, - Quantums: dtypes.NewInt(-40_000_000_000), // $-40,000 - }, - }, - PerpetualPositions: []*satypes.PerpetualPosition{ - { - PerpetualId: 0, - Quantums: dtypes.NewInt(100_000_000), // 1 BTC - }, - }, - }, - constants.Dave_Num0_1BTC_Long_50000USD, - }, - placedMatchableOrders: []clobtypes.MatchableOrder{ - &constants.LongTermOrder_Dave_Num0_Id0_Clob0_Buy1BTC_Price50000_GTBT10, - }, - liquidatableSubaccountIds: []satypes.SubaccountId{constants.Carl_Num0}, - liquidationConfig: constants.LiquidationsConfig_FillablePrice_Max_Smmr, - clobPairs: []clobtypes.ClobPair{constants.ClobPair_Btc}, - - // Provided liquidatable subaccount should be skipped in PrepareCheckState for not being liquidatable. - // This means no liquidation order placement / match will occur. - expectedSubaccounts: []satypes.Subaccount{ - { - Id: &constants.Carl_Num0, - AssetPositions: []*satypes.AssetPosition{ - { - AssetId: 0, - Quantums: dtypes.NewInt(-40_000_000_000), // $-40,000 - }, - }, - PerpetualPositions: []*satypes.PerpetualPosition{ - { - PerpetualId: 0, - Quantums: dtypes.NewInt(100_000_000), // 1 BTC - FundingIndex: dtypes.NewInt(0), - }, - }, - }, - constants.Dave_Num0_1BTC_Long_50000USD, - }, - }, `Can place a liquidation order that is partially filled and does not require deleveraging`: { subaccounts: []satypes.Subaccount{ constants.Carl_Num0_1BTC_Short_50499USD, diff --git a/protocol/x/perpetuals/client/cli/query_perpetual_test.go b/protocol/x/perpetuals/client/cli/query_perpetual_test.go index bef9977b2a..b6b6f30ae6 100644 --- a/protocol/x/perpetuals/client/cli/query_perpetual_test.go +++ b/protocol/x/perpetuals/client/cli/query_perpetual_test.go @@ -53,7 +53,6 @@ func networkWithLiquidityTierAndPerpetualObjects( Name: fmt.Sprintf("test_liquidity_tier_name_%d", i), InitialMarginPpm: uint32(1_000_000 / (i + 1)), MaintenanceFractionPpm: uint32(1_000_000 / (i + 1)), - BasePositionNotional: uint64(1_000_000_000 * (i + 1)), ImpactNotional: uint64(500_000_000 * (i + 1)), } nullify.Fill(&liquidityTier) //nolint:staticcheck diff --git a/protocol/x/perpetuals/genesis.go b/protocol/x/perpetuals/genesis.go index 4f67c3b378..373e51daa2 100644 --- a/protocol/x/perpetuals/genesis.go +++ b/protocol/x/perpetuals/genesis.go @@ -25,7 +25,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) elem.Name, elem.InitialMarginPpm, elem.MaintenanceFractionPpm, - elem.BasePositionNotional, elem.ImpactNotional, ) diff --git a/protocol/x/perpetuals/genesis_test.go b/protocol/x/perpetuals/genesis_test.go index 21ebf78124..7ec28797ee 100644 --- a/protocol/x/perpetuals/genesis_test.go +++ b/protocol/x/perpetuals/genesis_test.go @@ -41,7 +41,6 @@ func TestGenesis_Failure(t *testing.T) { ticker string initialMarginPpm uint32 maintenanceFractionPpm uint32 - basePositionNotional uint64 impactNotional uint64 fundingRateClampFactorPpm uint32 premiumVoteClampFactorPpm uint32 @@ -52,7 +51,6 @@ func TestGenesis_Failure(t *testing.T) { ticker: "genesis_ticker", initialMarginPpm: 0, maintenanceFractionPpm: 0, - basePositionNotional: 1, impactNotional: 1, fundingRateClampFactorPpm: 1, premiumVoteClampFactorPpm: 1, @@ -63,7 +61,6 @@ func TestGenesis_Failure(t *testing.T) { ticker: "", initialMarginPpm: 0, maintenanceFractionPpm: 0, - basePositionNotional: 1, impactNotional: 1, fundingRateClampFactorPpm: 1, premiumVoteClampFactorPpm: 1, @@ -74,7 +71,6 @@ func TestGenesis_Failure(t *testing.T) { ticker: "genesis_ticker", initialMarginPpm: lib.OneMillion + 1, maintenanceFractionPpm: 0, - basePositionNotional: 1, impactNotional: 1, fundingRateClampFactorPpm: 1, premiumVoteClampFactorPpm: 1, @@ -85,28 +81,16 @@ func TestGenesis_Failure(t *testing.T) { ticker: "genesis_ticker", initialMarginPpm: 0, maintenanceFractionPpm: lib.OneMillion + 1, - basePositionNotional: 1, impactNotional: 1, fundingRateClampFactorPpm: 1, premiumVoteClampFactorPpm: 1, minNumVotesPerSample: 0, }, - "Base Position Notional is zero": { - marketId: 0, - ticker: "genesis_ticker", - initialMarginPpm: 0, - maintenanceFractionPpm: lib.OneMillion + 1, - basePositionNotional: 0, - impactNotional: 1, - fundingRateClampFactorPpm: 1, - premiumVoteClampFactorPpm: 1, - }, "Impact Notional is zero": { marketId: 0, ticker: "genesis_ticker", initialMarginPpm: 0, maintenanceFractionPpm: lib.OneMillion + 1, - basePositionNotional: 1, impactNotional: 0, fundingRateClampFactorPpm: 1, premiumVoteClampFactorPpm: 1, @@ -117,7 +101,6 @@ func TestGenesis_Failure(t *testing.T) { ticker: "genesis_ticker", initialMarginPpm: 0, maintenanceFractionPpm: lib.OneMillion, - basePositionNotional: 1, impactNotional: 1, fundingRateClampFactorPpm: 0, premiumVoteClampFactorPpm: 1, @@ -128,7 +111,6 @@ func TestGenesis_Failure(t *testing.T) { ticker: "genesis_ticker", initialMarginPpm: 0, maintenanceFractionPpm: lib.OneMillion, - basePositionNotional: 1, impactNotional: 1, fundingRateClampFactorPpm: 1, premiumVoteClampFactorPpm: 0, @@ -151,7 +133,6 @@ func TestGenesis_Failure(t *testing.T) { Name: "", InitialMarginPpm: tc.initialMarginPpm, MaintenanceFractionPpm: tc.maintenanceFractionPpm, - BasePositionNotional: tc.basePositionNotional, ImpactNotional: tc.impactNotional, }, }, @@ -231,14 +212,5 @@ func assertLiquidityTierUpsertEventsInIndexerBlock( i, ) } - - if event.BasePositionNotional != liquidityTiers[i].BasePositionNotional { - t.Fatalf( - "Expected LiquidityTierUpsertEvent with BasePositionNotional %d, but got %d at index %d", - liquidityTiers[i].BasePositionNotional, - event.BasePositionNotional, - i, - ) - } } } diff --git a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go index 96ab16cfc2..9266628707 100644 --- a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go +++ b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier.go @@ -29,7 +29,6 @@ func (k msgServer) SetLiquidityTier( msg.LiquidityTier.Name, msg.LiquidityTier.InitialMarginPpm, msg.LiquidityTier.MaintenanceFractionPpm, - msg.LiquidityTier.BasePositionNotional, msg.LiquidityTier.ImpactNotional, ); err != nil { return nil, err diff --git a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go index 7274248eb8..e477624818 100644 --- a/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go +++ b/protocol/x/perpetuals/keeper/msg_server_set_liquidity_tier_test.go @@ -1,9 +1,10 @@ package keeper_test import ( - "github.com/dydxprotocol/v4-chain/protocol/lib" "testing" + "github.com/dydxprotocol/v4-chain/protocol/lib" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/dydxprotocol/v4-chain/protocol/testutil/constants" keepertest "github.com/dydxprotocol/v4-chain/protocol/testutil/keeper" @@ -19,7 +20,6 @@ func TestSetLiquidityTier(t *testing.T) { lttest.WithName("test"), lttest.WithInitialMarginPpm(1_000), lttest.WithMaintenanceFractionPpm(2_000), - lttest.WithBasePositionNotional(3_000), lttest.WithImpactNotional(4_000), ) @@ -35,7 +35,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "large-cap", InitialMarginPpm: 123_432, MaintenanceFractionPpm: testLt.MaintenanceFractionPpm, - BasePositionNotional: testLt.BasePositionNotional, ImpactNotional: testLt.ImpactNotional, }, }, @@ -48,7 +47,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "medium-cap", InitialMarginPpm: 567_123, MaintenanceFractionPpm: 500_001, - BasePositionNotional: 400_202, ImpactNotional: 1_300_303, }, }, @@ -61,7 +59,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "medium-cap", InitialMarginPpm: 567_123, MaintenanceFractionPpm: 500_001, - BasePositionNotional: 400_202, ImpactNotional: 1_300_303, }, }, @@ -74,7 +71,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "medium-cap", InitialMarginPpm: 1_000_001, MaintenanceFractionPpm: 500_001, - BasePositionNotional: 400_202, ImpactNotional: 1_300_303, }, }, @@ -88,7 +84,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "medium-cap", InitialMarginPpm: 500_001, MaintenanceFractionPpm: 1_000_001, - BasePositionNotional: 400_202, ImpactNotional: 1_300_303, }, }, @@ -102,7 +97,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "medium-cap", InitialMarginPpm: 567_123, MaintenanceFractionPpm: 500_001, - BasePositionNotional: 400_202, ImpactNotional: 1_300_303, }, }, @@ -116,7 +110,6 @@ func TestSetLiquidityTier(t *testing.T) { Name: "medium-cap", InitialMarginPpm: 567_123, MaintenanceFractionPpm: 500_001, - BasePositionNotional: 400_202, ImpactNotional: 1_300_303, }, }, @@ -133,7 +126,6 @@ func TestSetLiquidityTier(t *testing.T) { testLt.Name, testLt.InitialMarginPpm, testLt.MaintenanceFractionPpm, - testLt.BasePositionNotional, testLt.ImpactNotional, ) require.NoError(t, err) diff --git a/protocol/x/perpetuals/keeper/perpetual.go b/protocol/x/perpetuals/keeper/perpetual.go index 26fa55e14d..9d03408c48 100644 --- a/protocol/x/perpetuals/keeper/perpetual.go +++ b/protocol/x/perpetuals/keeper/perpetual.go @@ -836,9 +836,7 @@ func (k Keeper) GetNetCollateral( // // Margin requirements are a function of the absolute value of the open notional of the position as well as // the parameters of the relevant `LiquidityTier` of the perpetual. -// Initial margin requirement is determined by multiplying `InitialMarginPpm` by `marginAdjustmentPpm`, -// then limited to a maximum of 100%. `marginAdjustmentPpm“ is given by the equation -// `sqrt(notionalValue / liquidityTier.BasePositionNotional)` limited to a minimum of 100%. +// Initial margin requirement is determined by multiplying `InitialMarginPpm` and `notionalValue`. // `notionalValue` is determined by multiplying the size of the position by the oracle price of the position. // Maintenance margin requirement is then simply a fraction (`maintenanceFractionPpm`) of initial margin requirement. // @@ -891,8 +889,8 @@ func (k Keeper) GetMarginRequirements( marketPrice.Exponent, ) - // Initial margin requirement quote quantums = size in quote quantums * adjusted initial margin PPM. - bigInitialMarginQuoteQuantums = liquidityTier.GetAdjustedInitialMarginQuoteQuantums(bigQuoteQuantums) + // Initial margin requirement quote quantums = size in quote quantums * initial margin PPM. + bigInitialMarginQuoteQuantums = liquidityTier.GetInitialMarginQuoteQuantums(bigQuoteQuantums) // Maintenance margin requirement quote quantums = IM in quote quantums * maintenance fraction PPM. bigMaintenanceMarginQuoteQuantums = lib.BigRatRound( @@ -1297,7 +1295,6 @@ func (k Keeper) SetLiquidityTier( name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, - basePositionNotional uint64, impactNotional uint64, ) ( liquidityTier types.LiquidityTier, @@ -1309,7 +1306,6 @@ func (k Keeper) SetLiquidityTier( Name: name, InitialMarginPpm: initialMarginPpm, MaintenanceFractionPpm: maintenanceFractionPpm, - BasePositionNotional: basePositionNotional, ImpactNotional: impactNotional, } @@ -1332,7 +1328,6 @@ func (k Keeper) SetLiquidityTier( name, initialMarginPpm, maintenanceFractionPpm, - basePositionNotional, ), ), ) diff --git a/protocol/x/perpetuals/keeper/perpetual_test.go b/protocol/x/perpetuals/keeper/perpetual_test.go index b3ce8f6f37..8f6243ef7d 100644 --- a/protocol/x/perpetuals/keeper/perpetual_test.go +++ b/protocol/x/perpetuals/keeper/perpetual_test.go @@ -442,7 +442,6 @@ func TestGetAllPerpetuals_Sorted(t *testing.T) { func TestGetMarginRequirements_Success(t *testing.T) { oneBip := math.Pow10(2) - oneTrillion := 1_000_000_000_000 tests := map[string]struct { price uint64 exponent int32 @@ -450,7 +449,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums *big.Int initialMarginPpm uint32 maintenanceFractionPpm uint32 - basePositionNotional uint64 bigExpectedInitialMarginPpm *big.Int bigExpectedMaintenanceMarginPpm *big.Int }{ @@ -461,7 +459,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(7_000), initialMarginPpm: uint32(oneBip * 2), maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(7_777), bigExpectedMaintenanceMarginPpm: big.NewInt(3_889), }, @@ -472,7 +469,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(7_000), initialMarginPpm: uint32(oneBip * 100), maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(38_885_000), bigExpectedMaintenanceMarginPpm: big.NewInt(19_442_500), }, @@ -482,8 +478,7 @@ func TestGetMarginRequirements_Success(t *testing.T) { baseCurrencyAtomicResolution: -0, bigBaseQuantums: big.NewInt(88), initialMarginPpm: uint32(oneBip * 100), - maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(369_600_000_000_000), // same as quote quantums + maintenanceFractionPpm: uint32(500_000), // 50% of IM bigExpectedInitialMarginPpm: big.NewInt(3_696_000_000_000), bigExpectedMaintenanceMarginPpm: big.NewInt(1_848_000_000_000), }, @@ -494,7 +489,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(-5_000), initialMarginPpm: uint32(oneBip * 100), maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(21_000_000), bigExpectedMaintenanceMarginPpm: big.NewInt(10_500_000), }, @@ -505,7 +499,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(7_000), initialMarginPpm: uint32(oneBip * 10_000), maintenanceFractionPpm: uint32(1_000_000), // 100% of IM - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(38_885_000), bigExpectedMaintenanceMarginPpm: big.NewInt(38_885_000), }, @@ -516,7 +509,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(7_000), initialMarginPpm: uint32(oneBip * 100), maintenanceFractionPpm: uint32(1_000_000), // 100% of IM - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(388_850), bigExpectedMaintenanceMarginPpm: big.NewInt(388_850), }, @@ -527,7 +519,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(-7_000), initialMarginPpm: uint32(oneBip * 0.02), maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(77_770), bigExpectedMaintenanceMarginPpm: big.NewInt(38_885), }, @@ -538,7 +529,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(7_000), initialMarginPpm: uint32(oneBip * 0), maintenanceFractionPpm: uint32(1_000_000), // 100% of IM, - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(0), bigExpectedMaintenanceMarginPpm: big.NewInt(0), }, @@ -549,7 +539,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: big.NewInt(-7_000), initialMarginPpm: uint32(oneBip * 1), maintenanceFractionPpm: uint32(1_000_000), // 100% of IM, - basePositionNotional: uint64(oneTrillion), bigExpectedInitialMarginPpm: big.NewInt(0), bigExpectedMaintenanceMarginPpm: big.NewInt(0), }, @@ -560,103 +549,61 @@ func TestGetMarginRequirements_Success(t *testing.T) { bigBaseQuantums: new(big.Int).SetUint64(math.MaxUint64), initialMarginPpm: uint32(oneBip * 1), maintenanceFractionPpm: uint32(1_000_000), // 100% of IM, - basePositionNotional: math.MaxUint64, - // As both `price` and `bigBaseQuantums` are `MaxUint64`, `bigQuoteQuantums` (`= price * bigBaseQuantums`) - // has a value much higher than `MaxUint64` (3402823669209384634264811192843491082250). - // Now that `bigQuoteQuantums` has a much higher value than `basePositionNotional`, which is - // only the max value of a `uint64`, `marginAdjustmentPpm` is a very big value (13_581_879_131_294_591). - // Thus, adjusted initial margin (initial margin * margin adjustment) is capped at 100%, - // so adjusted initial margin in quote quantums = `100% * bigQuoteQuantums` = `bigQuoteQuantums`. bigExpectedInitialMarginPpm: big_testutil.MustFirst( - new(big.Int).SetString("3402823669209384634264811192843491082250", 10), + new(big.Int).SetString("340282366920938463426481119284349109", 10), ), bigExpectedMaintenanceMarginPpm: big_testutil.MustFirst( - new(big.Int).SetString("3402823669209384634264811192843491082250", 10), + new(big.Int).SetString("340282366920938463426481119284349109", 10), ), }, - "InitialMargin 100 BIPs, MaintenanceMargin 50 BIPs, atomic resolution 6, margin adjusted": { + "InitialMargin 100 BIPs, MaintenanceMargin 50 BIPs, atomic resolution 6": { price: 5_555, exponent: 0, baseCurrencyAtomicResolution: -6, bigBaseQuantums: big.NewInt(7_000), initialMarginPpm: uint32(oneBip * 100), maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(1_000_000), - // marginAdjustmentPpm = sqrt(quoteQuantums * (OneMillion * OneMillion) / basePositionNotional) - // = sqrt(38_885_000 * 1_000_000) ~= 6235783 - // initialMarginPpmQuoteQuantums = initialMarginPpm * quoteQuantums * marginAdjustmentPpm / 1_000_000 / 1_000_000 - // = 10_000 * 38_885_000 * 6235783 / 1_000_000 / 1_000_000 ~= 2_424_785 (rounded up). - bigExpectedInitialMarginPpm: big.NewInt(2_424_785), - bigExpectedMaintenanceMarginPpm: big.NewInt(1_212_393), - }, - "InitialMargin 20%, MaintenanceMargin 10%, atomic resolution 6, margin adjusted": { + // initialMarginPpmQuoteQuantums = initialMarginPpm * quoteQuantums / 1_000_000 + // = 10_000 * 38_885_000 / 1_000_000 ~= 388_850. + bigExpectedInitialMarginPpm: big.NewInt(388_850), + bigExpectedMaintenanceMarginPpm: big.NewInt(388_850 / 2), + }, + "InitialMargin 20%, MaintenanceMargin 10%, atomic resolution 6": { price: 36_750, exponent: 0, baseCurrencyAtomicResolution: -6, bigBaseQuantums: big.NewInt(12_000), initialMarginPpm: uint32(200_000), maintenanceFractionPpm: uint32(500_000), // 50% of IM - basePositionNotional: uint64(100_000_000), // quoteQuantums = 36_750 * 12_000 = 441_000_000 - // marginAdjustmentPpm = sqrt(quoteQuantums * (OneMillion * OneMillion) / basePositionNotional) - // = sqrt(441_000_000 * (OneMillion * OneMillion) / 100_000_000) ~= 2_100_000 - // initialMarginPpmQuoteQuantums = initialMarginPpm * quoteQuantums * marginAdjustmentPpm / 1_000_000 / 1_000_000 - // = 200_000 * 441_000_000 * 2_100_000 / 1_000_000 / 1_000_000 ~= 185_220_000 - bigExpectedInitialMarginPpm: big.NewInt(185_220_000), - bigExpectedMaintenanceMarginPpm: big.NewInt(92_610_000), - }, - "InitialMargin 5%, MaintenanceMargin 3%, atomic resolution 6, margin adjusted": { + // initialMarginPpmQuoteQuantums = initialMarginPpm * quoteQuantums / 1_000_000 + // = 200_000 * 441_000_000 / 1_000_000 ~= 88_200_000 + bigExpectedInitialMarginPpm: big.NewInt(88_200_000), + bigExpectedMaintenanceMarginPpm: big.NewInt(88_200_000 / 2), + }, + "InitialMargin 5%, MaintenanceMargin 3%, atomic resolution 6": { price: 123_456, exponent: 0, baseCurrencyAtomicResolution: -6, bigBaseQuantums: big.NewInt(74_523), initialMarginPpm: uint32(50_000), maintenanceFractionPpm: uint32(600_000), // 60% of IM - basePositionNotional: uint64(100_000_000), // quoteQuantums = 123_456 * 74_523 = 9_200_311_488 - // marginAdjustmentPpm = sqrt(quoteQuantums * (OneMillion * OneMillion) / basePositionNotional) - // = sqrt(9_200_311_488 * (OneMillion * OneMillion) / 100_000_000) ~= 9_591_825 - // initialMarginPpmQuoteQuantums = initialMarginPpm * quoteQuantums * marginAdjustmentPpm / 1_000_000 / 1_000_000 - // = 50_000 * 9_200_311_488 * 9_591_825 / 1_000_000 / 1_000_000 ~= 4_412_388_887 (rounded up) - bigExpectedInitialMarginPpm: big.NewInt(4_412_388_887), - bigExpectedMaintenanceMarginPpm: big.NewInt(2_647_433_333), - }, - "InitialMargin 25%, MaintenanceMargin 15%, atomic resolution 6, margin adjusted and IM capped at 100% of notional": { + // initialMarginPpmQuoteQuantums = initialMarginPpm * quoteQuantums / 1_000_000 + // = 50_000 * 9_200_311_488 / 1_000_000 ~= 460_015_575 + bigExpectedInitialMarginPpm: big.NewInt(460_015_575), + bigExpectedMaintenanceMarginPpm: big.NewInt(276_009_345), + }, + "InitialMargin 25%, MaintenanceMargin 15%, atomic resolution 6": { price: 123_456, exponent: 0, baseCurrencyAtomicResolution: -6, bigBaseQuantums: big.NewInt(74_523), initialMarginPpm: uint32(250_000), maintenanceFractionPpm: uint32(600_000), // 60% of IM - basePositionNotional: uint64(100_000_000), // quoteQuantums = 123_456 * 74_523 = 9_200_311_488 - // marginAdjustmentPpm = sqrt(quoteQuantums * (OneMillion * OneMillion) / basePositionNotional) - // = sqrt(9_200_311_488 * (OneMillion * OneMillion) / 100_000_000) ~= 9_591_825 - // After adjustment, initial margin is capped at 100% of notional (quote quantums). - bigExpectedInitialMarginPpm: big.NewInt(9_200_311_488), - bigExpectedMaintenanceMarginPpm: big.NewInt(5_520_186_893), - }, - "InitialMargin 10_000 BIPs (max), MaintenanceMargin 10_000 BIPs (max), atomic resolution 6, margin adjusted": { - price: 5_555, - exponent: 0, - baseCurrencyAtomicResolution: -6, - bigBaseQuantums: big.NewInt(7_000), - initialMarginPpm: uint32(oneBip * 10_000), - maintenanceFractionPpm: uint32(1_000_000), // 100% of IM - basePositionNotional: uint64(oneTrillion), - bigExpectedInitialMarginPpm: big.NewInt(38_885_000), - bigExpectedMaintenanceMarginPpm: big.NewInt(38_885_000), - }, - "InitialMargin 0 BIPs (min), MaintenanceMargin 0 BIPs (min), atomic resolution 6, margin adjusted": { - price: 5_555, - exponent: 0, - baseCurrencyAtomicResolution: -6, - bigBaseQuantums: big.NewInt(7_000), - initialMarginPpm: uint32(oneBip * 0), - maintenanceFractionPpm: uint32(1_000_000), // 100% of IM, - basePositionNotional: uint64(1_000_000), - bigExpectedInitialMarginPpm: big.NewInt(0), - bigExpectedMaintenanceMarginPpm: big.NewInt(0), + bigExpectedInitialMarginPpm: big.NewInt(2_300_077_872), + bigExpectedMaintenanceMarginPpm: big.NewInt(1_380_046_724), // Rounded up }, } @@ -703,7 +650,6 @@ func TestGetMarginRequirements_Success(t *testing.T) { "name", tc.initialMarginPpm, tc.maintenanceFractionPpm, - tc.basePositionNotional, 1, // dummy impact notional value ) require.NoError(t, err) @@ -2845,7 +2791,6 @@ func TestGetAllLiquidityTiers_Sorted(t *testing.T) { lt.Name, lt.InitialMarginPpm, lt.MaintenanceFractionPpm, - lt.BasePositionNotional, lt.ImpactNotional, ) require.NoError(t, err) @@ -2884,7 +2829,6 @@ func TestHasLiquidityTier(t *testing.T) { lt.Name, lt.InitialMarginPpm, lt.MaintenanceFractionPpm, - lt.BasePositionNotional, lt.ImpactNotional, ) require.NoError(t, err) @@ -2909,7 +2853,6 @@ func TestCreateLiquidityTier_Success(t *testing.T) { lt.Name, lt.InitialMarginPpm, lt.MaintenanceFractionPpm, - lt.BasePositionNotional, lt.ImpactNotional, ) require.NoError(t, err) @@ -2924,7 +2867,6 @@ func TestCreateLiquidityTier_Success(t *testing.T) { require.Equal(t, lt.Name, liquidityTier.Name) require.Equal(t, lt.InitialMarginPpm, liquidityTier.InitialMarginPpm) require.Equal(t, lt.MaintenanceFractionPpm, liquidityTier.MaintenanceFractionPpm) - require.Equal(t, lt.BasePositionNotional, liquidityTier.BasePositionNotional) require.Equal(t, lt.ImpactNotional, liquidityTier.ImpactNotional) } } @@ -2935,7 +2877,6 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { name string initialMarginPpm uint32 maintenanceFractionPpm uint32 - basePositionNotional uint64 impactNotional uint64 expectedError error }{ @@ -2944,7 +2885,6 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { name: "Large-Cap", initialMarginPpm: lib.OneMillion + 1, maintenanceFractionPpm: 500_000, - basePositionNotional: uint64(lib.OneMillion), impactNotional: uint64(lib.OneMillion), expectedError: errorsmod.Wrap(types.ErrInitialMarginPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, @@ -2953,25 +2893,14 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { name: "Medium-Cap", initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion + 1, - basePositionNotional: uint64(lib.OneMillion), impactNotional: uint64(lib.OneMillion), expectedError: errorsmod.Wrap(types.ErrMaintenanceFractionPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, - "Base Position Notional is zero": { - id: 1, - name: "Small-Cap", - initialMarginPpm: 500_000, - maintenanceFractionPpm: lib.OneMillion, - basePositionNotional: uint64(0), - impactNotional: uint64(lib.OneMillion), - expectedError: types.ErrBasePositionNotionalIsZero, - }, "Impact Notional is zero": { id: 1, name: "Small-Cap", initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion, - basePositionNotional: uint64(lib.OneMillion), impactNotional: uint64(0), expectedError: types.ErrImpactNotionalIsZero, }, @@ -2989,7 +2918,6 @@ func TestSetLiquidityTier_New_Failure(t *testing.T) { tc.name, tc.initialMarginPpm, tc.maintenanceFractionPpm, - tc.basePositionNotional, tc.impactNotional, ) @@ -3008,7 +2936,6 @@ func TestModifyLiquidityTier_Success(t *testing.T) { lt.Name, lt.InitialMarginPpm, lt.MaintenanceFractionPpm, - lt.BasePositionNotional, lt.ImpactNotional, ) require.NoError(t, err) @@ -3020,7 +2947,6 @@ func TestModifyLiquidityTier_Success(t *testing.T) { name := fmt.Sprintf("foo_%v", i) initialMarginPpm := uint32(i * 2) maintenanceFractionPpm := uint32(i * 2) - basePositionNotional := uint64((i + 1) * 1_000_000) impactNotional := uint64((i + 1) * 500_000_000) modifiedLt, err := pc.PerpetualsKeeper.SetLiquidityTier( pc.Ctx, @@ -3028,7 +2954,6 @@ func TestModifyLiquidityTier_Success(t *testing.T) { name, initialMarginPpm, maintenanceFractionPpm, - basePositionNotional, impactNotional, ) require.NoError(t, err) @@ -3054,11 +2979,6 @@ func TestModifyLiquidityTier_Success(t *testing.T) { maintenanceFractionPpm, obtainedLt.MaintenanceFractionPpm, ) - require.Equal( - t, - basePositionNotional, - obtainedLt.BasePositionNotional, - ) require.Equal( t, impactNotional, @@ -3075,7 +2995,6 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { name string initialMarginPpm uint32 maintenanceFractionPpm uint32 - basePositionNotional uint64 impactNotional uint64 expectedError error }{ @@ -3084,7 +3003,6 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { name: "Large-Cap", initialMarginPpm: lib.OneMillion + 1, maintenanceFractionPpm: 500_000, - basePositionNotional: uint64(lib.OneMillion), impactNotional: uint64(lib.OneMillion), expectedError: errorsmod.Wrap(types.ErrInitialMarginPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, @@ -3093,25 +3011,14 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { name: "Medium-Cap", initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion + 1, - basePositionNotional: uint64(lib.OneMillion), impactNotional: uint64(lib.OneMillion), expectedError: errorsmod.Wrap(types.ErrMaintenanceFractionPpmExceedsMax, fmt.Sprint(lib.OneMillion+1)), }, - "Base Position Notional is zero": { - id: 1, - name: "Small-Cap", - initialMarginPpm: 500_000, - maintenanceFractionPpm: lib.OneMillion, - basePositionNotional: uint64(0), - impactNotional: uint64(lib.OneMillion), - expectedError: types.ErrBasePositionNotionalIsZero, - }, "Impact Notional is zero": { id: 1, name: "Small-Cap", initialMarginPpm: 500_000, maintenanceFractionPpm: lib.OneMillion, - basePositionNotional: uint64(lib.OneMillion), impactNotional: uint64(0), expectedError: types.ErrImpactNotionalIsZero, }, @@ -3130,7 +3037,6 @@ func TestSetLiquidityTier_Existing_Failure(t *testing.T) { tc.name, tc.initialMarginPpm, tc.maintenanceFractionPpm, - tc.basePositionNotional, tc.impactNotional, ) diff --git a/protocol/x/perpetuals/module_test.go b/protocol/x/perpetuals/module_test.go index 64aab5ec86..2c76de5801 100644 --- a/protocol/x/perpetuals/module_test.go +++ b/protocol/x/perpetuals/module_test.go @@ -320,7 +320,6 @@ func TestAppModule_InitExportGenesis(t *testing.T) { "name":"Large-Cap", "initial_margin_ppm":50000, "maintenance_fraction_ppm":500000, - "base_position_notional":1000000000, "impact_notional":10000000000 } ], @@ -362,7 +361,7 @@ func TestAppModule_InitExportGenesis(t *testing.T) { "name":"Large-Cap", "initial_margin_ppm":50000, "maintenance_fraction_ppm":500000, - "base_position_notional":"1000000000", + "base_position_notional":"0", "impact_notional":"10000000000" } ], diff --git a/protocol/x/perpetuals/simulation/genesis.go b/protocol/x/perpetuals/simulation/genesis.go index c1d4a9a403..f7a920971d 100644 --- a/protocol/x/perpetuals/simulation/genesis.go +++ b/protocol/x/perpetuals/simulation/genesis.go @@ -91,17 +91,6 @@ func genInitialAndMaintenanceFraction(r *rand.Rand) (uint32, uint32) { return uint32(initialMargin), uint32(maintenanceFraction) } -// genBasePositionNotional returns a randomized notional value of base position. -func genBasePositionNotional(r *rand.Rand, isReasonableGenesis bool) uint64 { - return uint64( - simtypes.RandIntBetween( - r, - sim_helpers.PickGenesisParameter(sim_helpers.MinBasePositionNotional, isReasonableGenesis), - sim_helpers.PickGenesisParameter(sim_helpers.MaxBasePositionNotional, isReasonableGenesis)+1, - ), - ) -} - // calculateImpactNotional calculates impact notional as 500 USDC / initial margin fraction. func calculateImpactNotional(initialMarginPpm uint32) uint64 { // If initial margin is 0, return max uint64. @@ -167,14 +156,12 @@ func RandomizedGenState(simState *module.SimulationState) { liquidityTiers := make([]types.LiquidityTier, numLiquidityTiers) for i := 0; i < numLiquidityTiers; i++ { initialMarginPpm, maintenanceFractionPpm := genInitialAndMaintenanceFraction(r) - basePositionNotional := genBasePositionNotional(r, isReasonableGenesis) impactNotional := calculateImpactNotional(initialMarginPpm) liquidityTiers[i] = types.LiquidityTier{ Id: uint32(i), Name: fmt.Sprintf("%d", i), InitialMarginPpm: initialMarginPpm, MaintenanceFractionPpm: maintenanceFractionPpm, - BasePositionNotional: basePositionNotional, ImpactNotional: impactNotional, } } diff --git a/protocol/x/perpetuals/types/errors.go b/protocol/x/perpetuals/types/errors.go index 0d24550744..a7efb2dd26 100644 --- a/protocol/x/perpetuals/types/errors.go +++ b/protocol/x/perpetuals/types/errors.go @@ -62,11 +62,6 @@ var ( 12, "Liquidity Tier does not exist", ) - ErrBasePositionNotionalIsZero = errorsmod.Register( - ModuleName, - 13, - "Base position notional is zero", - ) ErrFundingRateClampFactorPpmIsZero = errorsmod.Register( ModuleName, 14, diff --git a/protocol/x/perpetuals/types/genesis_test.go b/protocol/x/perpetuals/types/genesis_test.go index deb30b6c85..8919ff6183 100644 --- a/protocol/x/perpetuals/types/genesis_test.go +++ b/protocol/x/perpetuals/types/genesis_test.go @@ -36,7 +36,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 500_000, MaintenanceFractionPpm: 750_000, - BasePositionNotional: 100, ImpactNotional: 1_000_000_000, }, }, @@ -74,7 +73,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 500_000, MaintenanceFractionPpm: 750_000, - BasePositionNotional: 100, ImpactNotional: 1_000_000_000, }, }, @@ -112,7 +110,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 500_000, MaintenanceFractionPpm: 750_000, - BasePositionNotional: 100, ImpactNotional: 1_000_000_000, }, }, @@ -142,7 +139,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 500_000, MaintenanceFractionPpm: 750_000, - BasePositionNotional: 100, ImpactNotional: 1_000_000_000, }, }, @@ -172,7 +168,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 1_000_001, MaintenanceFractionPpm: 750_000, - BasePositionNotional: 100, ImpactNotional: 1_000_000_000, }, }, @@ -202,7 +197,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 1_000, MaintenanceFractionPpm: 1_000_001, - BasePositionNotional: 100, ImpactNotional: 1_000_000_000, }, }, @@ -232,7 +226,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 100, ImpactNotional: 2_500_000_000, }, }, @@ -262,7 +255,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 100, ImpactNotional: 2_500_000_000, }, }, @@ -292,7 +284,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 100, ImpactNotional: 2_500_000_000, }, }, @@ -322,7 +313,6 @@ func TestGenesisState_Validate(t *testing.T) { Name: "Large-Cap", InitialMarginPpm: 200_000, MaintenanceFractionPpm: 1_000_000, - BasePositionNotional: 100, ImpactNotional: 0, }, }, diff --git a/protocol/x/perpetuals/types/liquidity_tier.go b/protocol/x/perpetuals/types/liquidity_tier.go index 2e49b1899a..957e5dfd87 100644 --- a/protocol/x/perpetuals/types/liquidity_tier.go +++ b/protocol/x/perpetuals/types/liquidity_tier.go @@ -10,7 +10,6 @@ import ( // - Initial margin is less than or equal to 1. // - Maintenance fraction is less than or equal to 1. -// - Base position notional is not 0. func (liquidityTier LiquidityTier) Validate() error { if liquidityTier.InitialMarginPpm > MaxInitialMarginPpm { return errorsmod.Wrap(ErrInitialMarginPpmExceedsMax, lib.UintToString(liquidityTier.InitialMarginPpm)) @@ -21,10 +20,6 @@ func (liquidityTier LiquidityTier) Validate() error { lib.UintToString(liquidityTier.MaintenanceFractionPpm)) } - if liquidityTier.BasePositionNotional == 0 { - return ErrBasePositionNotionalIsZero - } - if liquidityTier.ImpactNotional == 0 { return ErrImpactNotionalIsZero } @@ -68,52 +63,14 @@ func (liquidityTier LiquidityTier) GetMaxAbsFundingClampPpm(clampFactorPpm uint3 ) } -// GetMarginAdjustmentPpm calculates margin adjustment (in ppm) given quote quantums -// and `liquidityTier`'s base position notional. -// -// The idea is to have margin requirement increase as amount of notional increases. Adjustment -// is `1` for any position smaller than `basePositionNotional` and sqrt of position size -// for larger positions. Formula for marginAdjustmentPpm is: +// GetInitialMarginQuoteQuantums returns initial margin in quote quantums. // -// marginAdjustmentPpm = max( -// -// oneMillion, -// sqrt( -// quoteQuantums * (oneMillion * oneMillion) / basePositionNotional -// ) -// -// ) -func (liquidityTier LiquidityTier) GetMarginAdjustmentPpm(bigQuoteQuantums *big.Int) *big.Int { - bigBasePositionNotional := new(big.Int).SetUint64(liquidityTier.BasePositionNotional) - if bigQuoteQuantums.Cmp(bigBasePositionNotional) <= 0 { - return lib.BigIntOneMillion() - } - adjustmentFactor := new(big.Int).Mul(bigQuoteQuantums, lib.BigIntOneTrillion()) - adjustmentFactor.Quo(adjustmentFactor, bigBasePositionNotional) - return adjustmentFactor.Sqrt(adjustmentFactor) -} - -// GetAdjustedInitialMarginQuoteQuantums returns adjusted initial margin in quote quantums -// (capped at 100% of notional). -// -// marginQuoteQuantums = adjustedMarginPpm * quoteQuantums / 1_000_000 -// = min(1_000_000, marginAdjustmentPpm * marginPpm / 1_000_000) * quoteQuantums / 1_000_000 -// = min(quoteQuantums, marginPpm * quoteQuantums * marginAdjustmentPpm / 1_000_000 / 1_000_000) +// marginQuoteQuantums = initialMarginPpm * quoteQuantums / 1_000_000 // // note: divisions are delayed for precision purposes. -func (liquidityTier LiquidityTier) GetAdjustedInitialMarginQuoteQuantums(bigQuoteQuantums *big.Int) *big.Int { - marginAdjustmentPpm := liquidityTier.GetMarginAdjustmentPpm(bigQuoteQuantums) - - result := new(big.Rat).SetInt(marginAdjustmentPpm) - // Multiply `marginAdjustmentPpm` with `quoteQuantums`. - result = result.Mul(result, new(big.Rat).SetInt(bigQuoteQuantums)) +func (liquidityTier LiquidityTier) GetInitialMarginQuoteQuantums(bigQuoteQuantums *big.Int) *big.Int { + result := new(big.Rat).SetInt(bigQuoteQuantums) // Multiply above result with `initialMarginPpm` and divide by 1 million. result = lib.BigRatMulPpm(result, liquidityTier.InitialMarginPpm) - // Further divide above result by 1 million. - result = result.Quo(result, lib.BigRatOneMillion()) - // Cap adjusted initial margin at 100% of notional. - return lib.BigMin( - bigQuoteQuantums, - lib.BigRatRound(result, true), // Round up initial margin. - ) + return lib.BigRatRound(result, true) // Round up initial margin. } diff --git a/protocol/x/perpetuals/types/liquidity_tier_test.go b/protocol/x/perpetuals/types/liquidity_tier_test.go index ef5fbfe01f..99db8f3c19 100644 --- a/protocol/x/perpetuals/types/liquidity_tier_test.go +++ b/protocol/x/perpetuals/types/liquidity_tier_test.go @@ -5,7 +5,6 @@ import ( "math/big" "testing" - "github.com/dydxprotocol/v4-chain/protocol/lib" "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types" "github.com/stretchr/testify/require" ) @@ -14,43 +13,31 @@ func TestLiquidityTierValidate(t *testing.T) { tests := map[string]struct { initialMarginPpm uint32 maintenanceFractionPpm uint32 - BasePositionNotional uint64 ImpactNotional uint64 expectedError error }{ "Validates successfully": { - initialMarginPpm: 150_000, // 15% - maintenanceFractionPpm: 800_000, // 80% of IM - BasePositionNotional: 1_000_000_000_000, // 1 million USDC - ImpactNotional: 3_333_000_000, // 3_333 USDC + initialMarginPpm: 150_000, // 15% + maintenanceFractionPpm: 800_000, // 80% of IM + ImpactNotional: 3_333_000_000, // 3_333 USDC expectedError: nil, }, "Failure: initial margin ppm exceeds max": { - initialMarginPpm: 1_000_001, // above 100% - maintenanceFractionPpm: 800_000, // 80% of IM - BasePositionNotional: 1_000_000_000_000, // 1 million USDC - ImpactNotional: 1_000_000_000, // 1_000 USDC + initialMarginPpm: 1_000_001, // above 100% + maintenanceFractionPpm: 800_000, // 80% of IM + ImpactNotional: 1_000_000_000, // 1_000 USDC expectedError: types.ErrInitialMarginPpmExceedsMax, }, "Failure: maintenance fraction ppm exceeds max": { - initialMarginPpm: 1_000_000, // 100% - maintenanceFractionPpm: 1_000_001, // above 100% - BasePositionNotional: 1_000_000_000_000, // 1 million USDC - ImpactNotional: 1_000_000_000, // 1_000 USDC + initialMarginPpm: 1_000_000, // 100% + maintenanceFractionPpm: 1_000_001, // above 100% + ImpactNotional: 1_000_000_000, // 1_000 USDC expectedError: types.ErrMaintenanceFractionPpmExceedsMax, }, - "Failure: base position notional is zero": { - initialMarginPpm: 1_000_000, // 100% - maintenanceFractionPpm: 1_000_000, // 100% - BasePositionNotional: 0, // 0 - ImpactNotional: 500_000_000, // 500 USDC - expectedError: types.ErrBasePositionNotionalIsZero, - }, "Failure: impact notional is zero": { - initialMarginPpm: 1_000_000, // 100% - maintenanceFractionPpm: 1_000_000, // 100% - BasePositionNotional: 1_000_000_000_000, // 1 million USDC - ImpactNotional: 0, // 0 + initialMarginPpm: 1_000_000, // 100% + maintenanceFractionPpm: 1_000_000, // 100% + ImpactNotional: 0, // 0 expectedError: types.ErrImpactNotionalIsZero, }, } @@ -61,7 +48,6 @@ func TestLiquidityTierValidate(t *testing.T) { liquidityTier := &types.LiquidityTier{ InitialMarginPpm: tc.initialMarginPpm, MaintenanceFractionPpm: tc.maintenanceFractionPpm, - BasePositionNotional: tc.BasePositionNotional, ImpactNotional: tc.ImpactNotional, } @@ -213,117 +199,41 @@ func TestLiquidityTierGetMaxAbsFundingClampPpm(t *testing.T) { } } -func TestGetMarginAdjustmentPpm(t *testing.T) { - tests := map[string]struct { - bigQuoteQuantums *big.Int - basePositionNotional uint64 - expectedMarginAdjustmentPpm *big.Int - }{ - "position size in quote quantums less than base position notional": { - bigQuoteQuantums: big.NewInt(10), - basePositionNotional: 100, - expectedMarginAdjustmentPpm: lib.BigIntOneMillion(), - }, - "position size in quote quantums equal to base position notional": { - bigQuoteQuantums: big.NewInt(1000), - basePositionNotional: 1000, - expectedMarginAdjustmentPpm: lib.BigIntOneMillion(), - }, - "position size in quote quantums larger than base position notional": { - bigQuoteQuantums: big.NewInt(500_000), - basePositionNotional: 350_000, - // sqrt(500_000 * 1_000_000 * 1_000_000 / 350_000) ~= 1_195_228.609 - // floored integer value is 1_195_228. - expectedMarginAdjustmentPpm: big.NewInt(1_195_228), - }, - "position size in quote quantums is 0": { - bigQuoteQuantums: big.NewInt(0), - basePositionNotional: 350_000, - expectedMarginAdjustmentPpm: lib.BigIntOneMillion(), - }, - "position size in quote quantums and base position notional are both max": { - bigQuoteQuantums: new(big.Int).SetUint64(math.MaxUint64), - basePositionNotional: math.MaxUint64, - expectedMarginAdjustmentPpm: lib.BigIntOneMillion(), - }, - } - for name, tc := range tests { - t.Run(name, func(t *testing.T) { - liquidityTier := &types.LiquidityTier{ - BasePositionNotional: tc.basePositionNotional, - } - marginAdjustmentPpm := liquidityTier.GetMarginAdjustmentPpm(tc.bigQuoteQuantums) - - require.Equal(t, tc.expectedMarginAdjustmentPpm, marginAdjustmentPpm) - }) - } -} - -func TestGetAdjustedInitialMarginQuoteQuantums(t *testing.T) { +func TestGetInitialMarginQuoteQuantums(t *testing.T) { tests := map[string]struct { initialMarginPpm uint32 bigQuoteQuantums *big.Int - basePositionNotional uint64 expectedInitialMarginQuoteQuantums *big.Int }{ - "initial margin 20%, quote quantums < base position notional": { - initialMarginPpm: uint32(200_000), // 20% - bigQuoteQuantums: big.NewInt(500_000), - basePositionNotional: uint64(1_000_000), - // initial margin * margin adjustment * quote quantums + "initial margin 20%": { + initialMarginPpm: uint32(200_000), // 20% + bigQuoteQuantums: big.NewInt(500_000), + // initial margin * quote quantums // = 20% * 100% * 500_000 // = 100_000 expectedInitialMarginQuoteQuantums: big.NewInt(100_000), }, - "initial margin 50%, quote quantums == base position notional": { - initialMarginPpm: uint32(500_000), // 50% - bigQuoteQuantums: big.NewInt(1_000_000), - basePositionNotional: uint64(1_000_000), - // initial margin * margin adjustment * quote quantums + "initial margin 50%": { + initialMarginPpm: uint32(500_000), // 50% + bigQuoteQuantums: big.NewInt(1_000_000), + // initial margin * quote quantums // = 50% * 100% * 1_000_000 // = 500_000 expectedInitialMarginQuoteQuantums: big.NewInt(500_000), }, - "initial margin 40%, quote quantums > base position notional": { - initialMarginPpm: uint32(400_000), // 40% - bigQuoteQuantums: big.NewInt(4_000_000), - basePositionNotional: uint64(1_000_000), - // initial margin * margin adjustment * quote quantums - // = 40% * sqrt(4) * 4_000_000 - // = 3_200_000 - expectedInitialMarginQuoteQuantums: big.NewInt(3_200_000), - }, - "initial margin 60%, quote quantums > base position notional, adjusted margin capped at 100%": { - initialMarginPpm: uint32(600_000), // 60% - bigQuoteQuantums: big.NewInt(4_000_000), - basePositionNotional: uint64(1_000_000), - // initial margin * margin adjustment * quote quantums - // = 60% * sqrt(4) * 4_000_000 - // = 100% * 4_000_000 (adjusted margin capped at 100%) - // = 4_000_000 - expectedInitialMarginQuoteQuantums: big.NewInt(4_000_000), - }, - "initial margin 0%, quote quantums > base position notional": { - initialMarginPpm: uint32(0), // 0% - bigQuoteQuantums: big.NewInt(1_000_000_000_000), - basePositionNotional: uint64(1_000_000), - expectedInitialMarginQuoteQuantums: big.NewInt(0), - }, "initial margin 10%, quote quantums = 1, should round up to 1": { - initialMarginPpm: uint32(100_000), // 10% - bigQuoteQuantums: big.NewInt(1), - basePositionNotional: uint64(1_000_000), - // initial margin * margin adjustment * quote quantums - // = 10% * 100% * 1 + initialMarginPpm: uint32(100_000), // 10% + bigQuoteQuantums: big.NewInt(1), + // initial margin * quote quantums + // = 10% * 1 // = 0.1 -> round up to 1 expectedInitialMarginQuoteQuantums: big.NewInt(1), }, "initial margin 56.7243%, quote quantums = 123_456, should round up to 70_030": { - initialMarginPpm: uint32(567_243), // 56.7243% - bigQuoteQuantums: big.NewInt(123_456), - basePositionNotional: uint64(1_000_000), - // initial margin * margin adjustment * quote quantums - // = 56.7243% * 100% * 123_456 + initialMarginPpm: uint32(567_243), // 56.7243% + bigQuoteQuantums: big.NewInt(123_456), + // initial margin * quote quantums + // = 56.7243% * 123_456 // ~= 70029.5518 -> round up to 70030 expectedInitialMarginQuoteQuantums: big.NewInt(70_030), }, @@ -331,10 +241,9 @@ func TestGetAdjustedInitialMarginQuoteQuantums(t *testing.T) { for name, tc := range tests { t.Run(name, func(t *testing.T) { liquidityTier := &types.LiquidityTier{ - InitialMarginPpm: tc.initialMarginPpm, - BasePositionNotional: tc.basePositionNotional, + InitialMarginPpm: tc.initialMarginPpm, } - adjustedIMQuoteQuantums := liquidityTier.GetAdjustedInitialMarginQuoteQuantums(tc.bigQuoteQuantums) + adjustedIMQuoteQuantums := liquidityTier.GetInitialMarginQuoteQuantums(tc.bigQuoteQuantums) require.Equal(t, tc.expectedInitialMarginQuoteQuantums, adjustedIMQuoteQuantums) }) diff --git a/protocol/x/perpetuals/types/message_set_liquidity_tier_test.go b/protocol/x/perpetuals/types/message_set_liquidity_tier_test.go index 7412da2a42..00aa96055e 100644 --- a/protocol/x/perpetuals/types/message_set_liquidity_tier_test.go +++ b/protocol/x/perpetuals/types/message_set_liquidity_tier_test.go @@ -29,7 +29,6 @@ func TestMsgSetLiquidityTier_ValidateBasic(t *testing.T) { Name: "test", InitialMarginPpm: 217, MaintenanceFractionPpm: 217, - BasePositionNotional: 1_000, ImpactNotional: 5_000, }, }, @@ -48,7 +47,6 @@ func TestMsgSetLiquidityTier_ValidateBasic(t *testing.T) { Name: "test", InitialMarginPpm: 1_000_001, MaintenanceFractionPpm: 217, - BasePositionNotional: 1_000, ImpactNotional: 5_000, }, }, @@ -62,26 +60,11 @@ func TestMsgSetLiquidityTier_ValidateBasic(t *testing.T) { Name: "test", InitialMarginPpm: 217, MaintenanceFractionPpm: 1_000_001, - BasePositionNotional: 1_000, ImpactNotional: 5_000, }, }, expectedErr: "MaintenanceFractionPpm exceeds maximum value of 1e6", }, - "Failure: base position notional is zero": { - msg: types.MsgSetLiquidityTier{ - Authority: validAuthority, - LiquidityTier: types.LiquidityTier{ - Id: 1, - Name: "test", - InitialMarginPpm: 217, - MaintenanceFractionPpm: 217, - BasePositionNotional: 0, - ImpactNotional: 5_000, - }, - }, - expectedErr: "Base position notional is zero", - }, "Failure: impact notional is zero": { msg: types.MsgSetLiquidityTier{ Authority: validAuthority, @@ -90,7 +73,6 @@ func TestMsgSetLiquidityTier_ValidateBasic(t *testing.T) { Name: "test", InitialMarginPpm: 217, MaintenanceFractionPpm: 217, - BasePositionNotional: 1_000, ImpactNotional: 0, }, }, diff --git a/protocol/x/perpetuals/types/perpetual.pb.go b/protocol/x/perpetuals/types/perpetual.pb.go index bc5c72d689..8999eeef49 100644 --- a/protocol/x/perpetuals/types/perpetual.pb.go +++ b/protocol/x/perpetuals/types/perpetual.pb.go @@ -309,7 +309,9 @@ type LiquidityTier struct { // The maximum position size at which the margin requirements are // not increased over the default values. Above this position size, // the margin requirements increase at a rate of sqrt(size). - BasePositionNotional uint64 `protobuf:"varint,5,opt,name=base_position_notional,json=basePositionNotional,proto3" json:"base_position_notional,omitempty"` + // + // Deprecated since v3.x. + BasePositionNotional uint64 `protobuf:"varint,5,opt,name=base_position_notional,json=basePositionNotional,proto3" json:"base_position_notional,omitempty"` // Deprecated: Do not use. // The impact notional amount (in quote quantums) is used to determine impact // bid/ask prices and its recommended value is 500 USDC / initial margin // fraction. @@ -381,6 +383,7 @@ func (m *LiquidityTier) GetMaintenanceFractionPpm() uint32 { return 0 } +// Deprecated: Do not use. func (m *LiquidityTier) GetBasePositionNotional() uint64 { if m != nil { return m.BasePositionNotional @@ -408,44 +411,45 @@ func init() { } var fileDescriptor_ce7204eee10038be = []byte{ - // 592 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x4b, 0x1b, 0x41, - 0x14, 0xc7, 0xb3, 0x31, 0x0d, 0x3a, 0x26, 0xd1, 0x8c, 0x62, 0x17, 0x0b, 0x31, 0x0d, 0x14, 0x03, - 0x6d, 0x37, 0x60, 0x3d, 0xf4, 0xd0, 0x43, 0xf1, 0x20, 0x0d, 0xd4, 0x36, 0xac, 0xa5, 0x87, 0x42, - 0x59, 0x26, 0x3b, 0x63, 0x7c, 0x38, 0x3f, 0xb6, 0xb3, 0xb3, 0x45, 0xfb, 0x57, 0xf8, 0x37, 0xf5, - 0xe4, 0xd1, 0x63, 0xf1, 0x20, 0x45, 0xff, 0x8b, 0x9e, 0xca, 0xce, 0x4e, 0x36, 0xb1, 0x22, 0xf4, - 0x94, 0x99, 0xf7, 0xfd, 0xbc, 0x97, 0xef, 0x9b, 0x37, 0xb3, 0x68, 0x9b, 0x9e, 0xd1, 0xd3, 0x44, - 0x2b, 0xa3, 0x62, 0xc5, 0x07, 0x09, 0xd3, 0x09, 0x33, 0x19, 0xe1, 0xe9, 0x6c, 0x19, 0x58, 0x15, - 0x3f, 0x9e, 0x07, 0x83, 0x19, 0xb8, 0xb9, 0x3e, 0x51, 0x13, 0x65, 0x85, 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6, 0x4d, 0x34, 0x6d, 0x3e, 0x49, 0x84, 0xff, 0xc8, 0xe2, 0x6d, 0x27, 0xed, - 0x17, 0xca, 0x28, 0x11, 0xf8, 0x19, 0x6a, 0x71, 0xf8, 0x96, 0x01, 0x05, 0x73, 0x16, 0x19, 0x60, - 0xda, 0xaf, 0xdb, 0xbf, 0x6f, 0x96, 0xd1, 0x4f, 0xc0, 0x74, 0xef, 0x23, 0x6a, 0x1d, 0x58, 0x3f, - 0x23, 0xcd, 0x04, 0x64, 0x22, 0xc5, 0x4f, 0x51, 0xa3, 0x9c, 0x44, 0x54, 0x36, 0xb9, 0x5c, 0xc6, - 0x86, 0x14, 0x6f, 0xa2, 0xc5, 0xc4, 0xe1, 0x7e, 0xb5, 0xbb, 0xd0, 0x6f, 0x87, 0xe5, 0xbe, 0x77, - 0xee, 0xa1, 0x86, 0xab, 0x75, 0x68, 0x94, 0x66, 0xf8, 0x2b, 0x5a, 0x23, 0x9c, 0x47, 0xee, 0x18, - 0xca, 0x3c, 0xaf, 0xbb, 0xd0, 0x5f, 0xde, 0xd9, 0x7e, 0xf0, 0x0a, 0xdc, 0x75, 0xe5, 0x6e, 0x40, - 0x9b, 0x70, 0x7e, 0xdf, 0xae, 0xcc, 0x44, 0x34, 0xe7, 0xc7, 0xda, 0x95, 0x99, 0x98, 0x22, 0xbd, - 0x3f, 0x1e, 0x6a, 0xbe, 0x9f, 0xef, 0xfa, 0xde, 0xf8, 0x30, 0xaa, 0x49, 0x22, 0x98, 0x1b, 0x9e, - 0x5d, 0xe3, 0x17, 0x08, 0x83, 0x04, 0x03, 0xc4, 0x7a, 0x9f, 0x80, 0xb4, 0xe7, 0x5d, 0xcc, 0x70, - 0xd5, 0x29, 0x07, 0x56, 0xc8, 0x8f, 0xfb, 0x35, 0xf2, 0x05, 0x01, 0x69, 0x98, 0x24, 0x32, 0x66, - 0xd1, 0x91, 0x26, 0x71, 0x3e, 0x36, 0x9b, 0x53, 0xb3, 0x39, 0x1b, 0x73, 0xfa, 0xbe, 0x93, 0xf3, - 0xcc, 0x5d, 0xb4, 0x31, 0x26, 0x29, 0x8b, 0x12, 0x95, 0x82, 0x4d, 0x91, 0x2a, 0xff, 0x21, 0xdc, - 0xce, 0xb6, 0x16, 0xae, 0xe7, 0xea, 0xc8, 0x89, 0x1f, 0x9c, 0x86, 0xb7, 0xd1, 0x0a, 0x88, 0x84, - 0xc4, 0x66, 0x86, 0xd7, 0x2d, 0xde, 0x2a, 0xc2, 0x53, 0x70, 0xef, 0xf3, 0xc5, 0x4d, 0xc7, 0xbb, - 0xbc, 0xe9, 0x78, 0xbf, 0x6f, 0x3a, 0xde, 0xf9, 0x6d, 0xa7, 0x72, 0x79, 0xdb, 0xa9, 0xfc, 0xba, - 0xed, 0x54, 0xbe, 0xbc, 0xf9, 0xff, 0x77, 0x72, 0x3a, 0xff, 0x4d, 0xb0, 0x6f, 0x66, 0x5c, 0xb7, - 0xe2, 0xab, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0x7b, 0x2e, 0x21, 0x26, 0x3b, 0x04, 0x00, 0x00, + // 595 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0x4f, 0x4b, 0x1b, 0x4f, + 0x18, 0xce, 0xc4, 0xfc, 0x82, 0x8e, 0x49, 0x34, 0xa3, 0xf8, 0x5b, 0x2c, 0xc4, 0x34, 0x50, 0x0c, + 0xb4, 0xdd, 0x80, 0xed, 0xa1, 0x87, 0x1e, 0x4a, 0x0e, 0xd2, 0x40, 0x6d, 0xc3, 0x5a, 0x7a, 0x28, + 0x94, 0x65, 0xb2, 0x3b, 0xc6, 0x17, 0xe7, 0xcf, 0x76, 0x76, 0xb6, 0x68, 0x3f, 0x85, 0x9f, 0xa9, + 0x27, 0x8f, 0x1e, 0x8b, 0x07, 0x29, 0xfa, 0x3d, 0x4a, 0xd9, 0xd9, 0xc9, 0x26, 0x56, 0x84, 0x9e, + 0x32, 0xf3, 0x3e, 0xcf, 0xf3, 0xe6, 0x79, 0xe7, 0x99, 0x59, 0xbc, 0x1b, 0x9f, 0xc5, 0xa7, 0x89, + 0x56, 0x46, 0x45, 0x8a, 0x0f, 0x12, 0xa6, 0x13, 0x66, 0x32, 0xca, 0xd3, 0xf9, 0xd2, 0xb7, 0x28, + 0xf9, 0x7f, 0x91, 0xe8, 0xcf, 0x89, 0xdb, 0x9b, 0x53, 0x35, 0x55, 0x16, 0x18, 0xe4, 0xab, 0x82, + 0xde, 0xfb, 0x81, 0xf0, 0xca, 0x78, 0x46, 0x22, 0xfb, 0xb8, 0x9e, 0x50, 0x4d, 0x45, 0xea, 0xa1, + 0x2e, 0xea, 0xaf, 0xee, 0xf5, 0xfd, 0x07, 0xba, 0xf9, 0xa5, 0x66, 0x6c, 0xf9, 0xc3, 0xda, 0xc5, + 0xf5, 0x4e, 0x25, 0x70, 0x6a, 0x22, 0x70, 0xf3, 0x28, 0x93, 0x31, 0xc8, 0x69, 0x08, 0x32, 0x66, + 0xa7, 0x5e, 0xb5, 0x8b, 0xfa, 0x8d, 0xe1, 0xdb, 0x9c, 0x74, 0x75, 0xbd, 0xf3, 0x66, 0x0a, 0xe6, + 0x38, 0x9b, 0xf8, 0x91, 0x12, 0x83, 0x3b, 0x73, 0x7d, 0x7b, 0xf9, 0x3c, 0x3a, 0xa6, 0x20, 0x07, + 0x65, 0x25, 0x36, 0x67, 0x09, 0x4b, 0xfd, 0x43, 0xa6, 0x81, 0x72, 0xf8, 0x4e, 0x27, 0x9c, 0x8d, + 0xa4, 0x09, 0x1a, 0xae, 0xfd, 0x28, 0xef, 0xde, 0xbb, 0x42, 0x78, 0xed, 0x2f, 0x43, 0xa4, 0x85, + 0xab, 0x10, 0xdb, 0x31, 0x9a, 0x41, 0x15, 0x62, 0xb2, 0x85, 0xeb, 0x06, 0xa2, 0x13, 0xa6, 0xad, + 0x97, 0x95, 0xc0, 0xed, 0xc8, 0x23, 0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 0x49, 0x2a, 0x98, 0x0b, + 0xcf, 0xae, 0xc9, 0x33, 0x4c, 0x40, 0x82, 0x01, 0x6a, 0xbd, 0x4f, 0x41, 0xda, 0xf3, 0x2e, 0x32, + 0x5c, 0x77, 0xc8, 0x81, 0x05, 0xf2, 0xe3, 0x7e, 0x85, 0x3d, 0x41, 0x41, 0x1a, 0x26, 0xa9, 0x8c, + 0x58, 0x78, 0xa4, 0x69, 0x94, 0xc7, 0x66, 0x35, 0x35, 0xab, 0xd9, 0x5a, 0xc0, 0xf7, 0x1d, 0x5c, + 0x28, 0xb7, 0x26, 0x34, 0x65, 0x61, 0xa2, 0x52, 0xb0, 0x12, 0xa9, 0xf2, 0x1f, 0xca, 0x6d, 0xb6, + 0xb5, 0x61, 0xd5, 0x43, 0xc1, 0x66, 0xce, 0x18, 0x3b, 0xc2, 0x7b, 0x87, 0x93, 0x5d, 0xbc, 0x06, + 0x22, 0xa1, 0x91, 0x99, 0x4b, 0xf2, 0x8c, 0x6b, 0x41, 0xab, 0x28, 0xcf, 0x88, 0xc3, 0x4f, 0x17, + 0x37, 0x1d, 0x74, 0x79, 0xd3, 0x41, 0xbf, 0x6e, 0x3a, 0xe8, 0xfc, 0xb6, 0x53, 0xb9, 0xbc, 0xed, + 0x54, 0x7e, 0xde, 0x76, 0x2a, 0x9f, 0x5f, 0xff, 0xfb, 0x5b, 0x39, 0x5d, 0xfc, 0x2e, 0xd8, 0x77, + 0x33, 0xa9, 0x5b, 0xf0, 0xc5, 0x9f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf9, 0xc0, 0xd9, 0x87, 0x3f, + 0x04, 0x00, 0x00, } func (m *Perpetual) Marshal() (dAtA []byte, err error) { diff --git a/protocol/x/perpetuals/types/types.go b/protocol/x/perpetuals/types/types.go index 8a79cc08f7..f9a97f1a68 100644 --- a/protocol/x/perpetuals/types/types.go +++ b/protocol/x/perpetuals/types/types.go @@ -91,7 +91,6 @@ type PerpetualsKeeper interface { name string, initialMarginPpm uint32, maintenanceFractionPpm uint32, - basePositionNotional uint64, impactNotional uint64, ) ( liquidityTier LiquidityTier,