Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[OTE-248] Update LiquidityTierUpsertEvent to add OI caps #1242

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,12 @@ export interface LiquidityTierUpsertEventV1 {
/** @deprecated */

basePositionNotional: Long;
/** Lower cap of open interest in quote quantums. */

openInterestLowerCap: Long;
/** Upper cap of open interest in quote quantums. */

openInterestUpperCap: Long;
}
/**
* LiquidityTierUpsertEventV1 message contains all the information to
Expand Down Expand Up @@ -992,6 +998,12 @@ export interface LiquidityTierUpsertEventV1SDKType {
/** @deprecated */

base_position_notional: Long;
/** Lower cap of open interest in quote quantums. */

open_interest_lower_cap: Long;
/** Upper cap of open interest in quote quantums. */

open_interest_upper_cap: Long;
}
/**
* UpdateClobPairEventV1 message contains all the information about an update to
Expand Down Expand Up @@ -2675,7 +2687,9 @@ function createBaseLiquidityTierUpsertEventV1(): LiquidityTierUpsertEventV1 {
name: "",
initialMarginPpm: 0,
maintenanceFractionPpm: 0,
basePositionNotional: Long.UZERO
basePositionNotional: Long.UZERO,
openInterestLowerCap: Long.UZERO,
openInterestUpperCap: Long.UZERO
};
}

Expand All @@ -2701,6 +2715,14 @@ export const LiquidityTierUpsertEventV1 = {
writer.uint32(40).uint64(message.basePositionNotional);
}

if (!message.openInterestLowerCap.isZero()) {
writer.uint32(48).uint64(message.openInterestLowerCap);
}

if (!message.openInterestUpperCap.isZero()) {
writer.uint32(56).uint64(message.openInterestUpperCap);
}

return writer;
},

Expand Down Expand Up @@ -2733,6 +2755,14 @@ export const LiquidityTierUpsertEventV1 = {
message.basePositionNotional = (reader.uint64() as Long);
break;

case 6:
message.openInterestLowerCap = (reader.uint64() as Long);
break;

case 7:
message.openInterestUpperCap = (reader.uint64() as Long);
break;

default:
reader.skipType(tag & 7);
break;
Expand All @@ -2749,6 +2779,8 @@ export const LiquidityTierUpsertEventV1 = {
message.initialMarginPpm = object.initialMarginPpm ?? 0;
message.maintenanceFractionPpm = object.maintenanceFractionPpm ?? 0;
message.basePositionNotional = object.basePositionNotional !== undefined && object.basePositionNotional !== null ? Long.fromValue(object.basePositionNotional) : 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;
}

Expand Down
2 changes: 2 additions & 0 deletions indexer/services/ender/__tests__/helpers/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ export const defaultLiquidityTierUpsertEvent: LiquidityTierUpsertEventV1 = {
initialMarginPpm: 50000, // 5%
maintenanceFractionPpm: 600000, // 60% of IM = 3%
basePositionNotional: Long.fromValue(1_000_000_000_000, true), // 1_000_000 USDC
openInterestLowerCap: Long.fromValue(0, true),
openInterestUpperCap: Long.fromValue(1_000_000_000, true),
};

export const defaultUpdatePerpetualEvent: UpdatePerpetualEventV1 = {
Expand Down
6 changes: 6 additions & 0 deletions proto/dydxprotocol/indexer/events/events.proto
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,12 @@ message LiquidityTierUpsertEventV1 {
//
// Deprecated since v3.x.
uint64 base_position_notional = 5 [ deprecated = true ];

// Lower cap of open interest in quote quantums.
uint64 open_interest_lower_cap = 6;

// Upper cap of open interest in quote quantums.
uint64 open_interest_upper_cap = 7;
}

// UpdateClobPairEventV1 message contains all the information about an update to
Expand Down
Loading
Loading