From 518a7695424447bf495c70fa5197897d1beabb01 Mon Sep 17 00:00:00 2001 From: Teddy Ding Date: Tue, 21 Jan 2025 16:37:50 -0500 Subject: [PATCH] feat(funding): Add `defaultFunding8hrPpm` field to Perpetual Create/Update indexer events (#2674) --- indexer/packages/postgres/README.md | 2 + .../postgres/__tests__/db/migrations.test.ts | 25 +- .../postgres/__tests__/helpers/constants.ts | 5 + ...0107145033_default_1hr_funding_for_perp.ts | 13 + .../src/models/perpetual-market-model.ts | 4 + .../postgres/src/types/db-model-types.ts | 1 + .../src/types/perpetual-market-types.ts | 2 + .../src/types/websocket-message-types.ts | 1 + .../dydxprotocol/indexer/events/events.ts | 514 ++++++ .../dydxprotocol/perpetuals/perpetual.ts | 4 +- .../request-transformer.test.ts | 1 + .../comlink/public/api-documentation.md | 16 +- indexer/services/comlink/public/swagger.json | 3 + .../request-helpers/request-transformer.ts | 1 + indexer/services/comlink/src/types.ts | 1 + .../handlers/perpetual-market-handler.test.ts | 13 +- .../handlers/update-perpetual-handler.test.ts | 10 +- .../ender/__tests__/helpers/constants.ts | 42 + .../helpers/indexer-proto-helpers.ts | 25 + .../helpers/notification-functions.test.ts | 1 + .../ender/__tests__/lib/on-message.test.ts | 41 +- .../perpetual-market-validator.test.ts | 23 +- .../update-perpetual-validator.test.ts | 11 +- indexer/services/ender/package.json | 2 +- .../src/handlers/perpetual-market-handler.ts | 6 +- .../ender/src/helpers/kafka-helper.ts | 1 + .../helpers/postgres/postgres-functions.ts | 2 + .../services/ender/src/lib/block-processor.ts | 2 + indexer/services/ender/src/lib/helper.ts | 18 + indexer/services/ender/src/lib/types.ts | 14 + .../dydx_block_processor_ordered_handlers.sql | 4 + .../dydx_perpetual_market_v3_handler.sql | 45 + .../dydx_update_perpetual_v2_handler.sql | 3 +- .../dydx_update_perpetual_v3_handler.sql | 47 + .../validators/update-perpetual-validator.ts | 9 +- .../helpers/pnl-ticks-helper.test.ts | 1 + .../athena-ddl-tables/perpetual_markets.ts | 6 +- .../roundtable/src/tasks/market-updater.ts | 1 + .../dydxprotocol/indexer/events/events.proto | 96 ++ proto/dydxprotocol/perpetuals/perpetual.proto | 2 +- protocol/indexer/events/constants.go | 4 +- protocol/indexer/events/events.pb.go | 1382 ++++++++++++++--- protocol/indexer/events/perpetual.go | 20 +- .../indexer/events/perpetual_market_create.go | 6 +- .../events/perpetual_market_create_test.go | 4 +- protocol/indexer/events/perpetual_test.go | 16 +- protocol/testutil/keeper/clob.go | 1 + protocol/x/clob/abci_test.go | 4 +- protocol/x/clob/genesis_test.go | 1 + protocol/x/clob/keeper/clob_pair.go | 1 + protocol/x/clob/keeper/clob_pair_test.go | 8 + protocol/x/clob/keeper/deleveraging_test.go | 2 + .../x/clob/keeper/get_price_premium_test.go | 1 + protocol/x/clob/keeper/liquidations_test.go | 8 + .../msg_server_create_clob_pair_test.go | 1 + .../keeper/msg_server_place_order_test.go | 2 + protocol/x/clob/keeper/orders_test.go | 4 + .../x/clob/keeper/process_operations_test.go | 1 + protocol/x/clob/module_test.go | 1 + protocol/x/listing/keeper/listing.go | 1 + ...pgrade_isolated_perpetual_to_cross_test.go | 15 +- protocol/x/perpetuals/keeper/perpetual.go | 1 + .../x/perpetuals/keeper/perpetual_test.go | 23 +- protocol/x/perpetuals/types/perpetual.pb.go | 2 +- 64 files changed, 2256 insertions(+), 271 deletions(-) create mode 100644 indexer/packages/postgres/src/db/migrations/migration_files/20250107145033_default_1hr_funding_for_perp.ts create mode 100644 indexer/services/ender/src/scripts/handlers/dydx_perpetual_market_v3_handler.sql create mode 100644 indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v3_handler.sql diff --git a/indexer/packages/postgres/README.md b/indexer/packages/postgres/README.md index c4ddb219014..a8febac17f9 100644 --- a/indexer/packages/postgres/README.md +++ b/indexer/packages/postgres/README.md @@ -7,6 +7,8 @@ Add a knex migration by running `pnpm run migrate:make ` Run the migration with `pnpm run migrate` +In `__tests__/db/migrations.test.ts`, test cases may be expected to fail (and hence should be commented out) if a model is modified due to the latest migration. + In order to migrate in dev and staging, you must redeploy and run bazooka. TODO(CORE-512): Add info/resources around bazooka. [Doc](https://www.notion.so/dydx/Engineering-Runbook-15064661da9643188ce33e341b68e7bb#cb2283d80ef14a51924f3bd1a538fd82). diff --git a/indexer/packages/postgres/__tests__/db/migrations.test.ts b/indexer/packages/postgres/__tests__/db/migrations.test.ts index e41d4054168..ec68e8d44ac 100644 --- a/indexer/packages/postgres/__tests__/db/migrations.test.ts +++ b/indexer/packages/postgres/__tests__/db/migrations.test.ts @@ -10,8 +10,6 @@ import { } from '../helpers/constants'; import { seedData } from '../helpers/mock-generators'; -// NOTE: If a model is modified for a migration then these -// tests must be skipped until the following migration describe('Test new migration', () => { beforeEach(async () => { await migrate(); @@ -25,21 +23,36 @@ describe('Test new migration', () => { await teardown(); }); - it('test adding most recent migration', async () => { + it('test UP and DOWN for most recent migration without seed data', async () => { + // remove latest migration + await multiDown(1); + + // re-add latest migration + await knexPrimary.migrate.latest({ loadExtensions: ['.js'] }); + + // re-remove latest migration + await multiDown(1); + }); + + // NOTE: If a model is modified for a migration then these + // tests must be skipped until the following migration + it.skip('[Will fail if a model is modified for migration - see README] test adding most recent migration', async () => { // remove latest migration await multiDown(1); // add data to verify you can roll up and then later roll down await seedData(); - // readd latest migration + // re-add latest migration await knexPrimary.migrate.latest({ loadExtensions: ['.js'] }); // re-remove latest migration await multiDown(1); }); - it('test adding most recent migration with rows that fail index that should only be applied going forward', async () => { + // NOTE: If a model is modified for a migration then these + // tests must be skipped until the following migration + it.skip('[Will fail if a model is modified for migration - see README] test adding most recent migration with rows that fail index that should only be applied going forward', async () => { // remove latest migration await multiDown(1); @@ -47,7 +60,7 @@ describe('Test new migration', () => { await seedData(); await OrderTable.create(defaultOrder); - // readd latest migration + // re-add latest migration await knexPrimary.migrate.latest({ loadExtensions: ['.js'] }); // re-remove latest migration diff --git a/indexer/packages/postgres/__tests__/helpers/constants.ts b/indexer/packages/postgres/__tests__/helpers/constants.ts index bd6fc3ac447..cda89989a6b 100644 --- a/indexer/packages/postgres/__tests__/helpers/constants.ts +++ b/indexer/packages/postgres/__tests__/helpers/constants.ts @@ -285,6 +285,7 @@ export const defaultPerpetualMarket: PerpetualMarketCreateObject = { liquidityTierId: 0, marketType: PerpetualMarketType.CROSS, baseOpenInterest: '100000', + defaultFundingRate1H: '0', }; export const defaultPerpetualMarket2: PerpetualMarketCreateObject = { id: '1', @@ -304,6 +305,7 @@ export const defaultPerpetualMarket2: PerpetualMarketCreateObject = { liquidityTierId: 0, marketType: PerpetualMarketType.CROSS, baseOpenInterest: '100000', + defaultFundingRate1H: '0', }; export const defaultPerpetualMarket3: PerpetualMarketCreateObject = { id: '2', @@ -323,6 +325,7 @@ export const defaultPerpetualMarket3: PerpetualMarketCreateObject = { liquidityTierId: 0, marketType: PerpetualMarketType.CROSS, baseOpenInterest: '100000', + defaultFundingRate1H: '0', }; export const isolatedPerpetualMarket: PerpetualMarketCreateObject = { @@ -343,6 +346,7 @@ export const isolatedPerpetualMarket: PerpetualMarketCreateObject = { liquidityTierId: 0, marketType: PerpetualMarketType.ISOLATED, baseOpenInterest: '100000', + defaultFundingRate1H: '0.0001', }; export const isolatedPerpetualMarket2: PerpetualMarketCreateObject = { @@ -363,6 +367,7 @@ export const isolatedPerpetualMarket2: PerpetualMarketCreateObject = { liquidityTierId: 0, marketType: PerpetualMarketType.ISOLATED, baseOpenInterest: '100000', + defaultFundingRate1H: '0.0001', }; // ============== Orders ============== diff --git a/indexer/packages/postgres/src/db/migrations/migration_files/20250107145033_default_1hr_funding_for_perp.ts b/indexer/packages/postgres/src/db/migrations/migration_files/20250107145033_default_1hr_funding_for_perp.ts new file mode 100644 index 00000000000..466bcba80c0 --- /dev/null +++ b/indexer/packages/postgres/src/db/migrations/migration_files/20250107145033_default_1hr_funding_for_perp.ts @@ -0,0 +1,13 @@ +import * as Knex from 'knex'; + +export async function up(knex: Knex): Promise { + await knex.schema.alterTable('perpetual_markets', (table) => { + table.decimal('defaultFundingRate1H', null).defaultTo(0); + }); +} + +export async function down(knex: Knex): Promise { + await knex.schema.alterTable('perpetual_markets', (table) => { + table.dropColumn('defaultFundingRate1H'); + }); +} diff --git a/indexer/packages/postgres/src/models/perpetual-market-model.ts b/indexer/packages/postgres/src/models/perpetual-market-model.ts index 401cbdc39b7..972dae899d9 100644 --- a/indexer/packages/postgres/src/models/perpetual-market-model.ts +++ b/indexer/packages/postgres/src/models/perpetual-market-model.ts @@ -86,6 +86,7 @@ export default class PerpetualMarketModel extends Model { liquidityTierId: { type: 'integer' }, marketType: { type: 'string' }, baseOpenInterest: { type: 'string', pattern: NumericPattern }, + defaultFundingRate1H: { type: ['string', 'null'], default: null, pattern: NumericPattern }, }, }; } @@ -115,6 +116,7 @@ export default class PerpetualMarketModel extends Model { liquidityTierId: 'integer', marketType: 'string', baseOpenInterest: 'string', + defaultFundingRate1H: 'string', }; } @@ -151,4 +153,6 @@ export default class PerpetualMarketModel extends Model { marketType!: PerpetualMarketType; baseOpenInterest!: string; + + defaultFundingRate1H?: string; } diff --git a/indexer/packages/postgres/src/types/db-model-types.ts b/indexer/packages/postgres/src/types/db-model-types.ts index 9557be8edee..ad0d1a802e0 100644 --- a/indexer/packages/postgres/src/types/db-model-types.ts +++ b/indexer/packages/postgres/src/types/db-model-types.ts @@ -95,6 +95,7 @@ export interface PerpetualMarketFromDatabase { liquidityTierId: number, marketType: PerpetualMarketType, baseOpenInterest: string, + defaultFundingRate1H?: string, } export interface FillFromDatabase { diff --git a/indexer/packages/postgres/src/types/perpetual-market-types.ts b/indexer/packages/postgres/src/types/perpetual-market-types.ts index 47d4ce2dd74..9f75a625d09 100644 --- a/indexer/packages/postgres/src/types/perpetual-market-types.ts +++ b/indexer/packages/postgres/src/types/perpetual-market-types.ts @@ -18,6 +18,7 @@ export interface PerpetualMarketCreateObject { liquidityTierId: number, marketType: PerpetualMarketType, baseOpenInterest: string, + defaultFundingRate1H: string, } export interface PerpetualMarketUpdateObject { @@ -54,6 +55,7 @@ export enum PerpetualMarketColumns { subticksPerTick = 'subticksPerTick', stepBaseQuantums = 'stepBaseQuantums', liquidityTierId = 'liquidityTierId', + defaultFundingRate1H = 'defaultFundingRate1H', } export enum PerpetualMarketStatus { diff --git a/indexer/packages/postgres/src/types/websocket-message-types.ts b/indexer/packages/postgres/src/types/websocket-message-types.ts index 4f5f812250b..eb2e907099b 100644 --- a/indexer/packages/postgres/src/types/websocket-message-types.ts +++ b/indexer/packages/postgres/src/types/websocket-message-types.ts @@ -217,6 +217,7 @@ export interface TradingPerpetualMarketMessage { openInterestLowerCap?: string, openInterestUpperCap?: string, baseOpenInterest?: string, + defaultFundingRate1H?: string, // Fields that are likely to change priceChange24H?: string, 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 460f1d790da..f439504077d 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 @@ -959,8 +959,11 @@ export interface PerpetualMarketCreateEventV1SDKType { /** * PerpetualMarketCreateEventV2 message contains all the information about a * new Perpetual Market on the dYdX chain. + * Deprecated. Use PerpetualMarketCreateEventV3 for the most up to date message */ +/** @deprecated */ + export interface PerpetualMarketCreateEventV2 { /** * Unique Perpetual id. @@ -1032,8 +1035,11 @@ export interface PerpetualMarketCreateEventV2 { /** * PerpetualMarketCreateEventV2 message contains all the information about a * new Perpetual Market on the dYdX chain. + * Deprecated. Use PerpetualMarketCreateEventV3 for the most up to date message */ +/** @deprecated */ + export interface PerpetualMarketCreateEventV2SDKType { /** * Unique Perpetual id. @@ -1102,6 +1108,158 @@ export interface PerpetualMarketCreateEventV2SDKType { market_type: PerpetualMarketTypeSDKType; } +/** + * PerpetualMarketCreateEventV3 message contains all the information about a + * new Perpetual Market on the dYdX chain. + */ + +export interface PerpetualMarketCreateEventV3 { + /** + * Unique Perpetual id. + * Defined in perpetuals.perpetual + */ + id: number; + /** + * Unique clob pair Id associated with this perpetual market + * Defined in clob.clob_pair + */ + + clobPairId: number; + /** + * The name of the `Perpetual` (e.g. `BTC-USD`). + * Defined in perpetuals.perpetual + */ + + ticker: string; + /** + * Unique id of market param associated with this perpetual market. + * Defined in perpetuals.perpetual + */ + + marketId: number; + /** Status of the CLOB */ + + status: ClobPairStatus; + /** + * `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + * per Subtick. + * Defined in clob.clob_pair + */ + + quantumConversionExponent: number; + /** + * The exponent for converting an atomic amount (`size = 1`) + * to a full coin. For example, if `AtomicResolution = -8` + * then a `PerpetualPosition` with `size = 1e8` is equivalent to + * a position size of one full coin. + * Defined in perpetuals.perpetual + */ + + atomicResolution: number; + /** + * Defines the tick size of the orderbook by defining how many subticks + * are in one tick. That is, the subticks of any valid order must be a + * multiple of this value. Generally this value should start `>= 100`to + * allow room for decreasing it. + * Defined in clob.clob_pair + */ + + subticksPerTick: number; + /** + * Minimum increment in the size of orders on the CLOB, in base quantums. + * Defined in clob.clob_pair + */ + + stepBaseQuantums: Long; + /** + * The liquidity_tier that this perpetual is associated with. + * Defined in perpetuals.perpetual + */ + + liquidityTier: number; + /** Market type of the perpetual. */ + + marketType: PerpetualMarketType; + /** Default 8hr funding rate in parts-per-million. */ + + defaultFunding8hrPpm: number; +} +/** + * PerpetualMarketCreateEventV3 message contains all the information about a + * new Perpetual Market on the dYdX chain. + */ + +export interface PerpetualMarketCreateEventV3SDKType { + /** + * Unique Perpetual id. + * Defined in perpetuals.perpetual + */ + id: number; + /** + * Unique clob pair Id associated with this perpetual market + * Defined in clob.clob_pair + */ + + clob_pair_id: number; + /** + * The name of the `Perpetual` (e.g. `BTC-USD`). + * Defined in perpetuals.perpetual + */ + + ticker: string; + /** + * Unique id of market param associated with this perpetual market. + * Defined in perpetuals.perpetual + */ + + market_id: number; + /** Status of the CLOB */ + + status: ClobPairStatusSDKType; + /** + * `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + * per Subtick. + * Defined in clob.clob_pair + */ + + quantum_conversion_exponent: number; + /** + * The exponent for converting an atomic amount (`size = 1`) + * to a full coin. For example, if `AtomicResolution = -8` + * then a `PerpetualPosition` with `size = 1e8` is equivalent to + * a position size of one full coin. + * Defined in perpetuals.perpetual + */ + + atomic_resolution: number; + /** + * Defines the tick size of the orderbook by defining how many subticks + * are in one tick. That is, the subticks of any valid order must be a + * multiple of this value. Generally this value should start `>= 100`to + * allow room for decreasing it. + * Defined in clob.clob_pair + */ + + subticks_per_tick: number; + /** + * Minimum increment in the size of orders on the CLOB, in base quantums. + * Defined in clob.clob_pair + */ + + step_base_quantums: Long; + /** + * The liquidity_tier that this perpetual is associated with. + * Defined in perpetuals.perpetual + */ + + liquidity_tier: number; + /** Market type of the perpetual. */ + + market_type: PerpetualMarketTypeSDKType; + /** Default 8hr funding rate in parts-per-million. */ + + default_funding8hr_ppm: number; +} /** * LiquidityTierUpsertEventV1 message contains all the information to * create/update a Liquidity Tier on the dYdX chain. @@ -1335,8 +1493,11 @@ export interface UpdatePerpetualEventV1SDKType { /** * UpdatePerpetualEventV2 message contains all the information about an update * to a perpetual on the dYdX chain. + * Deprecated. Use UpdatePerpetualEventV3. */ +/** @deprecated */ + export interface UpdatePerpetualEventV2 { /** * Unique Perpetual id. @@ -1377,8 +1538,11 @@ export interface UpdatePerpetualEventV2 { /** * UpdatePerpetualEventV2 message contains all the information about an update * to a perpetual on the dYdX chain. + * Deprecated. Use UpdatePerpetualEventV3. */ +/** @deprecated */ + export interface UpdatePerpetualEventV2SDKType { /** * Unique Perpetual id. @@ -1416,6 +1580,96 @@ export interface UpdatePerpetualEventV2SDKType { market_type: PerpetualMarketTypeSDKType; } +/** + * UpdatePerpetualEventV3 message contains all the information about an update + * to a perpetual on the dYdX chain. + */ + +export interface UpdatePerpetualEventV3 { + /** + * Unique Perpetual id. + * Defined in perpetuals.perpetual + */ + id: number; + /** + * The name of the `Perpetual` (e.g. `BTC-USD`). + * Defined in perpetuals.perpetual + */ + + ticker: string; + /** + * Unique id of market param associated with this perpetual market. + * Defined in perpetuals.perpetual + */ + + marketId: number; + /** + * The exponent for converting an atomic amount (`size = 1`) + * to a full coin. For example, if `AtomicResolution = -8` + * then a `PerpetualPosition` with `size = 1e8` is equivalent to + * a position size of one full coin. + * Defined in perpetuals.perpetual + */ + + atomicResolution: number; + /** + * The liquidity_tier that this perpetual is associated with. + * Defined in perpetuals.perpetual + */ + + liquidityTier: number; + /** Market type of the perpetual. */ + + marketType: PerpetualMarketType; + /** Default 8hr funding rate in parts-per-million. */ + + defaultFunding8hrPpm: number; +} +/** + * UpdatePerpetualEventV3 message contains all the information about an update + * to a perpetual on the dYdX chain. + */ + +export interface UpdatePerpetualEventV3SDKType { + /** + * Unique Perpetual id. + * Defined in perpetuals.perpetual + */ + id: number; + /** + * The name of the `Perpetual` (e.g. `BTC-USD`). + * Defined in perpetuals.perpetual + */ + + ticker: string; + /** + * Unique id of market param associated with this perpetual market. + * Defined in perpetuals.perpetual + */ + + market_id: number; + /** + * The exponent for converting an atomic amount (`size = 1`) + * to a full coin. For example, if `AtomicResolution = -8` + * then a `PerpetualPosition` with `size = 1e8` is equivalent to + * a position size of one full coin. + * Defined in perpetuals.perpetual + */ + + atomic_resolution: number; + /** + * The liquidity_tier that this perpetual is associated with. + * Defined in perpetuals.perpetual + */ + + liquidity_tier: number; + /** Market type of the perpetual. */ + + market_type: PerpetualMarketTypeSDKType; + /** Default 8hr funding rate in parts-per-million. */ + + default_funding8hr_ppm: number; +} /** * TradingRewardsEventV1 is communicates all trading rewards for all accounts * that receive trade rewards in the block. @@ -3322,6 +3576,161 @@ export const PerpetualMarketCreateEventV2 = { }; +function createBasePerpetualMarketCreateEventV3(): PerpetualMarketCreateEventV3 { + return { + id: 0, + clobPairId: 0, + ticker: "", + marketId: 0, + status: 0, + quantumConversionExponent: 0, + atomicResolution: 0, + subticksPerTick: 0, + stepBaseQuantums: Long.UZERO, + liquidityTier: 0, + marketType: 0, + defaultFunding8hrPpm: 0 + }; +} + +export const PerpetualMarketCreateEventV3 = { + encode(message: PerpetualMarketCreateEventV3, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + + if (message.clobPairId !== 0) { + writer.uint32(16).uint32(message.clobPairId); + } + + if (message.ticker !== "") { + writer.uint32(26).string(message.ticker); + } + + if (message.marketId !== 0) { + writer.uint32(32).uint32(message.marketId); + } + + if (message.status !== 0) { + writer.uint32(40).int32(message.status); + } + + if (message.quantumConversionExponent !== 0) { + writer.uint32(48).sint32(message.quantumConversionExponent); + } + + if (message.atomicResolution !== 0) { + writer.uint32(56).sint32(message.atomicResolution); + } + + if (message.subticksPerTick !== 0) { + writer.uint32(64).uint32(message.subticksPerTick); + } + + if (!message.stepBaseQuantums.isZero()) { + writer.uint32(72).uint64(message.stepBaseQuantums); + } + + if (message.liquidityTier !== 0) { + writer.uint32(80).uint32(message.liquidityTier); + } + + if (message.marketType !== 0) { + writer.uint32(88).int32(message.marketType); + } + + if (message.defaultFunding8hrPpm !== 0) { + writer.uint32(96).int32(message.defaultFunding8hrPpm); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): PerpetualMarketCreateEventV3 { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBasePerpetualMarketCreateEventV3(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + + case 2: + message.clobPairId = reader.uint32(); + break; + + case 3: + message.ticker = reader.string(); + break; + + case 4: + message.marketId = reader.uint32(); + break; + + case 5: + message.status = (reader.int32() as any); + break; + + case 6: + message.quantumConversionExponent = reader.sint32(); + break; + + case 7: + message.atomicResolution = reader.sint32(); + break; + + case 8: + message.subticksPerTick = reader.uint32(); + break; + + case 9: + message.stepBaseQuantums = (reader.uint64() as Long); + break; + + case 10: + message.liquidityTier = reader.uint32(); + break; + + case 11: + message.marketType = (reader.int32() as any); + break; + + case 12: + message.defaultFunding8hrPpm = reader.int32(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): PerpetualMarketCreateEventV3 { + const message = createBasePerpetualMarketCreateEventV3(); + message.id = object.id ?? 0; + message.clobPairId = object.clobPairId ?? 0; + message.ticker = object.ticker ?? ""; + message.marketId = object.marketId ?? 0; + message.status = object.status ?? 0; + message.quantumConversionExponent = object.quantumConversionExponent ?? 0; + message.atomicResolution = object.atomicResolution ?? 0; + message.subticksPerTick = object.subticksPerTick ?? 0; + message.stepBaseQuantums = object.stepBaseQuantums !== undefined && object.stepBaseQuantums !== null ? Long.fromValue(object.stepBaseQuantums) : Long.UZERO; + message.liquidityTier = object.liquidityTier ?? 0; + message.marketType = object.marketType ?? 0; + message.defaultFunding8hrPpm = object.defaultFunding8hrPpm ?? 0; + return message; + } + +}; + function createBaseLiquidityTierUpsertEventV1(): LiquidityTierUpsertEventV1 { return { id: 0, @@ -3672,6 +4081,111 @@ export const UpdatePerpetualEventV2 = { }; +function createBaseUpdatePerpetualEventV3(): UpdatePerpetualEventV3 { + return { + id: 0, + ticker: "", + marketId: 0, + atomicResolution: 0, + liquidityTier: 0, + marketType: 0, + defaultFunding8hrPpm: 0 + }; +} + +export const UpdatePerpetualEventV3 = { + encode(message: UpdatePerpetualEventV3, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer { + if (message.id !== 0) { + writer.uint32(8).uint32(message.id); + } + + if (message.ticker !== "") { + writer.uint32(18).string(message.ticker); + } + + if (message.marketId !== 0) { + writer.uint32(24).uint32(message.marketId); + } + + if (message.atomicResolution !== 0) { + writer.uint32(32).sint32(message.atomicResolution); + } + + if (message.liquidityTier !== 0) { + writer.uint32(40).uint32(message.liquidityTier); + } + + if (message.marketType !== 0) { + writer.uint32(48).int32(message.marketType); + } + + if (message.defaultFunding8hrPpm !== 0) { + writer.uint32(56).int32(message.defaultFunding8hrPpm); + } + + return writer; + }, + + decode(input: _m0.Reader | Uint8Array, length?: number): UpdatePerpetualEventV3 { + const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUpdatePerpetualEventV3(); + + while (reader.pos < end) { + const tag = reader.uint32(); + + switch (tag >>> 3) { + case 1: + message.id = reader.uint32(); + break; + + case 2: + message.ticker = reader.string(); + break; + + case 3: + message.marketId = reader.uint32(); + break; + + case 4: + message.atomicResolution = reader.sint32(); + break; + + case 5: + message.liquidityTier = reader.uint32(); + break; + + case 6: + message.marketType = (reader.int32() as any); + break; + + case 7: + message.defaultFunding8hrPpm = reader.int32(); + break; + + default: + reader.skipType(tag & 7); + break; + } + } + + return message; + }, + + fromPartial(object: DeepPartial): UpdatePerpetualEventV3 { + const message = createBaseUpdatePerpetualEventV3(); + message.id = object.id ?? 0; + message.ticker = object.ticker ?? ""; + message.marketId = object.marketId ?? 0; + message.atomicResolution = object.atomicResolution ?? 0; + message.liquidityTier = object.liquidityTier ?? 0; + message.marketType = object.marketType ?? 0; + message.defaultFunding8hrPpm = object.defaultFunding8hrPpm ?? 0; + return message; + } + +}; + function createBaseTradingRewardsEventV1(): TradingRewardsEventV1 { return { tradingRewards: [] 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 720980b76d3..edef9ef967c 100644 --- a/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts +++ b/indexer/packages/v4-protos/src/codegen/dydxprotocol/perpetuals/perpetual.ts @@ -115,7 +115,7 @@ export interface PerpetualParams { atomicResolution: number; /** - * The default funding payment if there is no price premium. In + * The default (8hr) funding payment if there is no price premium. In * parts-per-million. */ @@ -154,7 +154,7 @@ export interface PerpetualParamsSDKType { atomic_resolution: number; /** - * The default funding payment if there is no price premium. In + * The default (8hr) funding payment if there is no price premium. In * parts-per-million. */ diff --git a/indexer/services/comlink/__tests__/lib/request-helpers/request-transformer.test.ts b/indexer/services/comlink/__tests__/lib/request-helpers/request-transformer.test.ts index 553861281e0..2f45bfd6937 100644 --- a/indexer/services/comlink/__tests__/lib/request-helpers/request-transformer.test.ts +++ b/indexer/services/comlink/__tests__/lib/request-helpers/request-transformer.test.ts @@ -81,6 +81,7 @@ describe('request-transformer', () => { openInterestLowerCap: liquidityTier.openInterestLowerCap, openInterestUpperCap: liquidityTier.openInterestUpperCap, baseOpenInterest: perpetualMarket.baseOpenInterest, + defaultFundingRate1H: perpetualMarket.defaultFundingRate1H, }, ); }); diff --git a/indexer/services/comlink/public/api-documentation.md b/indexer/services/comlink/public/api-documentation.md index 8a3518a8693..0aebabb2559 100644 --- a/indexer/services/comlink/public/api-documentation.md +++ b/indexer/services/comlink/public/api-documentation.md @@ -2506,7 +2506,8 @@ fetch(`${baseURL}/perpetualMarkets`, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", - "baseOpenInterest": "string" + "baseOpenInterest": "string", + "defaultFundingRate1H": "string" }, "property2": { "clobPairId": "string", @@ -2529,7 +2530,8 @@ fetch(`${baseURL}/perpetualMarkets`, "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", - "baseOpenInterest": "string" + "baseOpenInterest": "string", + "defaultFundingRate1H": "string" } } } @@ -5387,7 +5389,8 @@ or "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", - "baseOpenInterest": "string" + "baseOpenInterest": "string", + "defaultFundingRate1H": "string" } ``` @@ -5417,6 +5420,7 @@ or |openInterestLowerCap|string|false|none|none| |openInterestUpperCap|string|false|none|none| |baseOpenInterest|string|true|none|none| +|defaultFundingRate1H|string|false|none|none| ## PerpetualMarketResponse @@ -5449,7 +5453,8 @@ or "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", - "baseOpenInterest": "string" + "baseOpenInterest": "string", + "defaultFundingRate1H": "string" }, "property2": { "clobPairId": "string", @@ -5472,7 +5477,8 @@ or "marketType": "CROSS", "openInterestLowerCap": "string", "openInterestUpperCap": "string", - "baseOpenInterest": "string" + "baseOpenInterest": "string", + "defaultFundingRate1H": "string" } } } diff --git a/indexer/services/comlink/public/swagger.json b/indexer/services/comlink/public/swagger.json index 0737485b430..df26429665e 100644 --- a/indexer/services/comlink/public/swagger.json +++ b/indexer/services/comlink/public/swagger.json @@ -1138,6 +1138,9 @@ }, "baseOpenInterest": { "type": "string" + }, + "defaultFundingRate1H": { + "type": "string" } }, "required": [ diff --git a/indexer/services/comlink/src/request-helpers/request-transformer.ts b/indexer/services/comlink/src/request-helpers/request-transformer.ts index 17f741bce50..7c566ca8e58 100644 --- a/indexer/services/comlink/src/request-helpers/request-transformer.ts +++ b/indexer/services/comlink/src/request-helpers/request-transformer.ts @@ -389,6 +389,7 @@ export function perpetualMarketToResponseObject( openInterestLowerCap: liquidityTier.openInterestLowerCap, openInterestUpperCap: liquidityTier.openInterestUpperCap, baseOpenInterest: perpetualMarket.baseOpenInterest, + defaultFundingRate1H: perpetualMarket.defaultFundingRate1H, }; } diff --git a/indexer/services/comlink/src/types.ts b/indexer/services/comlink/src/types.ts index 30e540d4b04..7796f0ffc28 100644 --- a/indexer/services/comlink/src/types.ts +++ b/indexer/services/comlink/src/types.ts @@ -352,6 +352,7 @@ export interface PerpetualMarketResponseObject { openInterestLowerCap?: string, openInterestUpperCap?: string, baseOpenInterest: string, + defaultFundingRate1H?: string, } /* ------- ORDERBOOK TYPES ------- */ diff --git a/indexer/services/ender/__tests__/handlers/perpetual-market-handler.test.ts b/indexer/services/ender/__tests__/handlers/perpetual-market-handler.test.ts index 1ef52a98c74..e118a1a9a68 100644 --- a/indexer/services/ender/__tests__/handlers/perpetual-market-handler.test.ts +++ b/indexer/services/ender/__tests__/handlers/perpetual-market-handler.test.ts @@ -1,6 +1,7 @@ import { PerpetualMarketCreateEventV1, PerpetualMarketCreateEventV2, + PerpetualMarketCreateEventV3, IndexerTendermintBlock, IndexerTendermintEvent, Timestamp, @@ -29,11 +30,13 @@ import { expectPerpetualMarketV1, expectPerpetualMarketKafkaMessage, expectPerpetualMarketV2, + expectPerpetualMarketV3, } from '../helpers/indexer-proto-helpers'; import { PerpetualMarketCreationHandler } from '../../src/handlers/perpetual-market-handler'; import { defaultPerpetualMarketCreateEventV1, defaultPerpetualMarketCreateEventV2, + defaultPerpetualMarketCreateEventV3, defaultHeight, defaultPreviousHeight, defaultTime, @@ -89,12 +92,20 @@ describe('perpetualMarketHandler', () => { expectPerpetualMarketV2, defaultPerpetualMarketCreateEventV2, ], + [ + 'PerpetualMarketCreateEventV3', + 3, + PerpetualMarketCreateEventV3.encode(defaultPerpetualMarketCreateEventV3).finish(), + expectPerpetualMarketV3, + defaultPerpetualMarketCreateEventV3, + ], ])('%s', ( _name: string, version: number, perpetualMarketCreateEventBytes: Uint8Array, expectPerpetualMarket: Function, - event: PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2, + event: PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3, ) => { it('returns the correct parallelization ids', () => { const transactionIndex: number = 0; diff --git a/indexer/services/ender/__tests__/handlers/update-perpetual-handler.test.ts b/indexer/services/ender/__tests__/handlers/update-perpetual-handler.test.ts index 9fdbc43acb8..fd8045c7045 100644 --- a/indexer/services/ender/__tests__/handlers/update-perpetual-handler.test.ts +++ b/indexer/services/ender/__tests__/handlers/update-perpetual-handler.test.ts @@ -14,6 +14,7 @@ import { defaultTxHash, defaultUpdatePerpetualEventV1, defaultUpdatePerpetualEventV2, + defaultUpdatePerpetualEventV3, } from '../helpers/constants'; import { IndexerTendermintBlock, @@ -21,6 +22,7 @@ import { Timestamp, UpdatePerpetualEventV1, UpdatePerpetualEventV2, + UpdatePerpetualEventV3, } from '@dydxprotocol-indexer/v4-protos'; import { createIndexerTendermintBlock, @@ -71,10 +73,16 @@ describe('update-perpetual-handler', () => { UpdatePerpetualEventV2.encode(defaultUpdatePerpetualEventV2).finish(), defaultUpdatePerpetualEventV2, ], + [ + 'UpdatePerpetualEventV3', + UpdatePerpetualEventV3.encode(defaultUpdatePerpetualEventV3).finish(), + defaultUpdatePerpetualEventV3, + ], ])('%s', ( _name: string, updatePerpetualEventBytes: Uint8Array, - event: UpdatePerpetualEventV1 | UpdatePerpetualEventV2, + event: UpdatePerpetualEventV1 | UpdatePerpetualEventV2 + | UpdatePerpetualEventV3, ) => { it('returns the correct parallelization ids', () => { const transactionIndex: number = 0; diff --git a/indexer/services/ender/__tests__/helpers/constants.ts b/indexer/services/ender/__tests__/helpers/constants.ts index a90a03c0abc..c96257e5b9a 100644 --- a/indexer/services/ender/__tests__/helpers/constants.ts +++ b/indexer/services/ender/__tests__/helpers/constants.ts @@ -26,6 +26,7 @@ import { OrderRemovalReason, PerpetualMarketCreateEventV1, PerpetualMarketCreateEventV2, + PerpetualMarketCreateEventV3, PerpetualMarketType, StatefulOrderEventV1, SubaccountMessage, @@ -36,6 +37,7 @@ import { UpdateClobPairEventV1, UpdatePerpetualEventV1, UpdatePerpetualEventV2, + UpdatePerpetualEventV3, OpenInterestUpdateEventV1, OpenInterestUpdate, } from '@dydxprotocol-indexer/v4-protos'; @@ -167,6 +169,36 @@ export const defaultPerpetualMarketCreateEventV2: PerpetualMarketCreateEventV2 = marketType: PerpetualMarketType.PERPETUAL_MARKET_TYPE_ISOLATED, }; +export const defaultPerpetualMarketCreateEvent3: PerpetualMarketCreateEventV3 = { + id: 0, + clobPairId: 1, + ticker: 'BTC-USD', + marketId: 0, + status: ClobPairStatus.CLOB_PAIR_STATUS_INITIALIZING, + quantumConversionExponent: -8, + atomicResolution: -10, + subticksPerTick: 100, + stepBaseQuantums: Long.fromValue(10, true), + liquidityTier: 0, + marketType: PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS, + defaultFunding8hrPpm: 100, +}; + +export const defaultPerpetualMarketCreateEventV3: PerpetualMarketCreateEventV3 = { + id: 0, + clobPairId: 1, + ticker: 'BTC-USD', + marketId: 0, + status: ClobPairStatus.CLOB_PAIR_STATUS_INITIALIZING, + quantumConversionExponent: -8, + atomicResolution: -10, + subticksPerTick: 100, + stepBaseQuantums: Long.fromValue(10, true), + liquidityTier: 0, + marketType: PerpetualMarketType.PERPETUAL_MARKET_TYPE_ISOLATED, + defaultFunding8hrPpm: 100, +}; + export const defaultLiquidityTierUpsertEventV2: LiquidityTierUpsertEventV2 = { id: 0, name: 'Large-Cap', @@ -216,6 +248,16 @@ export const defaultUpdatePerpetualEventV2: UpdatePerpetualEventV2 = { marketType: PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS, }; +export const defaultUpdatePerpetualEventV3: UpdatePerpetualEventV3 = { + id: 0, + ticker: 'BTC-USD2', + marketId: 1, + atomicResolution: -8, + liquidityTier: 1, + marketType: PerpetualMarketType.PERPETUAL_MARKET_TYPE_CROSS, + defaultFunding8hrPpm: 100, +}; + export const defaultUpdateClobPairEvent: UpdateClobPairEventV1 = { clobPairId: 1, status: ClobPairStatus.CLOB_PAIR_STATUS_ACTIVE, diff --git a/indexer/services/ender/__tests__/helpers/indexer-proto-helpers.ts b/indexer/services/ender/__tests__/helpers/indexer-proto-helpers.ts index d0fe5ea32ed..45b5df28049 100644 --- a/indexer/services/ender/__tests__/helpers/indexer-proto-helpers.ts +++ b/indexer/services/ender/__tests__/helpers/indexer-proto-helpers.ts @@ -56,6 +56,7 @@ import { IndexerOrderId, PerpetualMarketCreateEventV1, PerpetualMarketCreateEventV2, + PerpetualMarketCreateEventV3, DeleveragingEventV1, protoTimestampToDate, PerpetualMarketType, @@ -971,6 +972,30 @@ export function expectPerpetualMarketV2( })); } +export function expectPerpetualMarketV3( + perpetualMarket: PerpetualMarketFromDatabase, + perpetual: PerpetualMarketCreateEventV3, +): void { + // TODO(IND-219): Set initialMarginFraction/maintenanceMarginFraction using LiquidityTier + expect(perpetualMarket).toEqual(expect.objectContaining({ + ...HARDCODED_PERPETUAL_MARKET_VALUES, + id: perpetual.id.toString(), + status: PerpetualMarketStatus.INITIALIZING, + clobPairId: perpetual.clobPairId.toString(), + ticker: perpetual.ticker, + marketId: perpetual.marketId, + quantumConversionExponent: perpetual.quantumConversionExponent, + atomicResolution: perpetual.atomicResolution, + subticksPerTick: perpetual.subticksPerTick, + stepBaseQuantums: Number(perpetual.stepBaseQuantums), + liquidityTierId: perpetual.liquidityTier, + marketType: eventPerpetualMarketTypeToIndexerPerpetualMarketType( + perpetual.marketType, + ), + defaultFundingRate1H: ((perpetual.defaultFunding8hrPpm / 1_000_000) / 8).toString(), + })); +} + export function eventPerpetualMarketTypeToIndexerPerpetualMarketType( perpetualMarketType: PerpetualMarketType, ): string { diff --git a/indexer/services/ender/__tests__/helpers/notification-functions.test.ts b/indexer/services/ender/__tests__/helpers/notification-functions.test.ts index 23cc5553231..bd9cfb27501 100644 --- a/indexer/services/ender/__tests__/helpers/notification-functions.test.ts +++ b/indexer/services/ender/__tests__/helpers/notification-functions.test.ts @@ -51,6 +51,7 @@ const mockMarket: PerpetualMarketFromDatabase = { liquidityTierId: 1, marketType: PerpetualMarketType.ISOLATED, baseOpenInterest: '0', + defaultFundingRate1H: '0', }; describe('notification functions', () => { diff --git a/indexer/services/ender/__tests__/lib/on-message.test.ts b/indexer/services/ender/__tests__/lib/on-message.test.ts index ae521b33511..03fae7ea679 100644 --- a/indexer/services/ender/__tests__/lib/on-message.test.ts +++ b/indexer/services/ender/__tests__/lib/on-message.test.ts @@ -26,7 +26,8 @@ import { IndexerTendermintBlock, IndexerTendermintEvent, MarketEventV1, - PerpetualMarketCreateEventV1, + PerpetualMarketCreateEventV2, + PerpetualMarketCreateEventV3, SubaccountMessage, SubaccountUpdateEventV1, Timestamp, @@ -46,7 +47,8 @@ import { defaultFundingUpdateSampleEvent, defaultHeight, defaultMarketModify, - defaultPerpetualMarketCreateEventV1, + defaultPerpetualMarketCreateEventV2, + defaultPerpetualMarketCreateEventV3, defaultPreviousHeight, defaultSubaccountMessage, } from '../helpers/constants'; @@ -133,9 +135,15 @@ describe('on-message', () => { defaultMarketModify, ).finish()); - const defaultPerpetualMarketEventBinary: Uint8Array = Uint8Array.from( - PerpetualMarketCreateEventV1.encode( - defaultPerpetualMarketCreateEventV1, + const defaultPerpetualMarketEventV2Binary: Uint8Array = Uint8Array.from( + PerpetualMarketCreateEventV2.encode( + defaultPerpetualMarketCreateEventV2, + ).finish(), + ); + + const defaultPerpetualMarketEventV3Binary: Uint8Array = Uint8Array.from( + PerpetualMarketCreateEventV3.encode( + defaultPerpetualMarketCreateEventV3, ).finish(), ); @@ -252,7 +260,22 @@ describe('on-message', () => { expect.any(Number), 1, { success: 'true' }); }); - it('successfully processes block with market create and its funding events', async () => { + it.each([ + [ + 'PerpetualMarketCreateV2', + defaultPerpetualMarketCreateEventV2, + defaultPerpetualMarketEventV2Binary, + ], + [ + 'PerpetualMarketCreateV3', + defaultPerpetualMarketCreateEventV3, + defaultPerpetualMarketEventV3Binary, + ], + ])('successfully processes block with %s and its funding events', async ( + _name: string, + marketCreateEvent: any, + marketCreateEventBinary: Uint8Array, + ) => { await Promise.all([ MarketTable.create(testConstants.defaultMarket), MarketTable.create(testConstants.defaultMarket2), @@ -274,13 +297,13 @@ describe('on-message', () => { const events: IndexerTendermintEvent[] = [ createIndexerTendermintEvent( DydxIndexerSubtypes.PERPETUAL_MARKET, - defaultPerpetualMarketEventBinary, + marketCreateEventBinary, 0, eventIndex, ), createIndexerTendermintEvent( DydxIndexerSubtypes.FUNDING, - defaultFundingEventBinary, + marketCreateEventBinary, transactionIndex, eventIndex + 1, ), @@ -309,7 +332,7 @@ describe('on-message', () => { orderBy: [[PerpetualMarketColumns.id, Ordering.ASC]], }); expect(newPerpetualMarkets.length).toEqual(2); - expectPerpetualMarketMatchesEvent(defaultPerpetualMarketCreateEventV1, newPerpetualMarkets[0]); + expectPerpetualMarketMatchesEvent(marketCreateEvent, newPerpetualMarkets[0]); expect(stats.increment).toHaveBeenCalledWith('ender.received_kafka_message', 1); expect(stats.timing).toHaveBeenCalledWith( diff --git a/indexer/services/ender/__tests__/validators/perpetual-market-validator.test.ts b/indexer/services/ender/__tests__/validators/perpetual-market-validator.test.ts index 305ddb8e965..19de024e656 100644 --- a/indexer/services/ender/__tests__/validators/perpetual-market-validator.test.ts +++ b/indexer/services/ender/__tests__/validators/perpetual-market-validator.test.ts @@ -2,6 +2,7 @@ import { logger, ParseMessageError } from '@dydxprotocol-indexer/base'; import { PerpetualMarketCreateEventV1, PerpetualMarketCreateEventV2, + PerpetualMarketCreateEventV3, IndexerTendermintBlock, IndexerTendermintEvent, } from '@dydxprotocol-indexer/v4-protos'; @@ -12,6 +13,7 @@ import { DydxIndexerSubtypes } from '../../src/lib/types'; import { defaultPerpetualMarketCreateEventV1, defaultPerpetualMarketCreateEventV2, + defaultPerpetualMarketCreateEventV3, defaultHeight, defaultTime, defaultTxHash, @@ -49,11 +51,18 @@ describe('perpetual-market-validator', () => { PerpetualMarketCreateEventV2.encode(defaultPerpetualMarketCreateEventV2).finish(), defaultPerpetualMarketCreateEventV2, ], + [ + 'PerpetualMarketCreateEventV3', + 3, + PerpetualMarketCreateEventV3.encode(defaultPerpetualMarketCreateEventV3).finish(), + defaultPerpetualMarketCreateEventV3, + ], ])('validate %s', ( _name: string, version: number, perpetualMarketCreateEventBytes: Uint8Array, - event: PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2, + event: PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3, ) => { it('does not throw error on valid perpetual market create event', () => { const validator: PerpetualMarketValidator = new PerpetualMarketValidator( @@ -83,7 +92,8 @@ describe('perpetual-market-validator', () => { { ...event, ticker: '', - } as PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2, + } as PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3, 'PerpetualMarketCreateEvent ticker is not populated', ], [ @@ -91,7 +101,8 @@ describe('perpetual-market-validator', () => { { ...event, subticksPerTick: 0, - } as PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2, + } as PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3, 'PerpetualMarketCreateEvent subticksPerTick is not populated', ], [ @@ -99,12 +110,14 @@ describe('perpetual-market-validator', () => { { ...event, stepBaseQuantums: Long.fromValue(0, true), - } as PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2, + } as PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3, 'PerpetualMarketCreateEvent stepBaseQuantums is not populated', ], ])('%s', ( _description: string, - eventToTest: PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2, + eventToTest: PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3, expectedMessage: string, ) => { const validator: PerpetualMarketValidator = new PerpetualMarketValidator( diff --git a/indexer/services/ender/__tests__/validators/update-perpetual-validator.test.ts b/indexer/services/ender/__tests__/validators/update-perpetual-validator.test.ts index 5cb6bb4c144..7481b845c57 100644 --- a/indexer/services/ender/__tests__/validators/update-perpetual-validator.test.ts +++ b/indexer/services/ender/__tests__/validators/update-perpetual-validator.test.ts @@ -4,6 +4,7 @@ import { IndexerTendermintEvent, UpdatePerpetualEventV1, UpdatePerpetualEventV2, + UpdatePerpetualEventV3, } from '@dydxprotocol-indexer/v4-protos'; import { dbHelpers, testMocks, perpetualMarketRefresher, @@ -12,6 +13,7 @@ import { DydxIndexerSubtypes } from '../../src/lib/types'; import { defaultUpdatePerpetualEventV1, defaultUpdatePerpetualEventV2, + defaultUpdatePerpetualEventV3, defaultHeight, defaultTime, defaultTxHash, @@ -51,14 +53,19 @@ describe('update-perpetual-validator', () => { defaultUpdatePerpetualEventV1, ], [ - 'PerpetualMarketCreateEventV2', + 'UpdatePerpetualEventV2', UpdatePerpetualEventV2.encode(defaultUpdatePerpetualEventV2).finish(), defaultUpdatePerpetualEventV2, ], + [ + 'UpdatePerpetualEventV3', + UpdatePerpetualEventV3.encode(defaultUpdatePerpetualEventV3).finish(), + defaultUpdatePerpetualEventV3, + ], ])('%s', ( _name: string, updatePerpetualEventBytes: Uint8Array, - event: UpdatePerpetualEventV1 | UpdatePerpetualEventV2, + event: UpdatePerpetualEventV1 | UpdatePerpetualEventV2 | UpdatePerpetualEventV3, ) => { it('does not throw error on valid perpetual market create event', () => { const validator: UpdatePerpetualValidator = new UpdatePerpetualValidator( diff --git a/indexer/services/ender/package.json b/indexer/services/ender/package.json index b8c40a60f79..ae577e9cd22 100644 --- a/indexer/services/ender/package.json +++ b/indexer/services/ender/package.json @@ -7,7 +7,7 @@ "start": "node --heapsnapshot-signal=SIGUSR2 -r dd-trace/init -r dotenv-flow/config build/src/index.js", "build": "rm -rf build/ && tsc && cp -r src/scripts build/src/scripts", "build:prod": "pnpm run build", - "build:watch": "pnpm run build -- --watch", + "build:watch": "rm -rf build/ && tsc --watch && cp -r src/scripts build/src/scripts", "coverage": "pnpm test -- --coverage", "lint": "eslint --ext .ts,.js .", "lint:fix": "eslint --ext .ts,.js . --fix", diff --git a/indexer/services/ender/src/handlers/perpetual-market-handler.ts b/indexer/services/ender/src/handlers/perpetual-market-handler.ts index e02b36df73b..03cb8b61fe6 100644 --- a/indexer/services/ender/src/handlers/perpetual-market-handler.ts +++ b/indexer/services/ender/src/handlers/perpetual-market-handler.ts @@ -3,7 +3,10 @@ import { PerpetualMarketFromDatabase, PerpetualMarketModel, perpetualMarketRefresher, } from '@dydxprotocol-indexer/postgres'; -import { PerpetualMarketCreateEventV1, PerpetualMarketCreateEventV2 } from '@dydxprotocol-indexer/v4-protos'; +import { + PerpetualMarketCreateEventV1, PerpetualMarketCreateEventV2, + PerpetualMarketCreateEventV3, +} from '@dydxprotocol-indexer/v4-protos'; import * as pg from 'pg'; import config from '../config'; @@ -13,6 +16,7 @@ import { Handler } from './handler'; export class PerpetualMarketCreationHandler extends Handler< PerpetualMarketCreateEventV1 | PerpetualMarketCreateEventV2 + | PerpetualMarketCreateEventV3 > { eventType: string = 'PerpetualMarketCreateEvent'; diff --git a/indexer/services/ender/src/helpers/kafka-helper.ts b/indexer/services/ender/src/helpers/kafka-helper.ts index db88bdac28b..24ae7eaa84d 100644 --- a/indexer/services/ender/src/helpers/kafka-helper.ts +++ b/indexer/services/ender/src/helpers/kafka-helper.ts @@ -347,6 +347,7 @@ export function generatePerpetualMarketMessage( nextFundingRate: perpetualMarket.nextFundingRate, openInterest: perpetualMarket.openInterest, baseOpenInterest: perpetualMarket.baseOpenInterest, + defaultFundingRate1H: perpetualMarket.defaultFundingRate1H, }; }) .value(); diff --git a/indexer/services/ender/src/helpers/postgres/postgres-functions.ts b/indexer/services/ender/src/helpers/postgres/postgres-functions.ts index aaae9616ceb..1088e9e94aa 100644 --- a/indexer/services/ender/src/helpers/postgres/postgres-functions.ts +++ b/indexer/services/ender/src/helpers/postgres/postgres-functions.ts @@ -38,6 +38,7 @@ const HANDLER_SCRIPTS: string[] = [ 'dydx_market_price_update_handler.sql', 'dydx_perpetual_market_v1_handler.sql', 'dydx_perpetual_market_v2_handler.sql', + 'dydx_perpetual_market_v3_handler.sql', 'dydx_register_affiliate_handler.sql', 'dydx_stateful_order_handler.sql', 'dydx_subaccount_update_handler.sql', @@ -46,6 +47,7 @@ const HANDLER_SCRIPTS: string[] = [ 'dydx_update_clob_pair_handler.sql', 'dydx_update_perpetual_v1_handler.sql', 'dydx_update_perpetual_v2_handler.sql', + 'dydx_update_perpetual_v3_handler.sql', 'dydx_vault_upsert_handler.sql', ]; diff --git a/indexer/services/ender/src/lib/block-processor.ts b/indexer/services/ender/src/lib/block-processor.ts index f00a5cd0611..a9cafd4f97c 100644 --- a/indexer/services/ender/src/lib/block-processor.ts +++ b/indexer/services/ender/src/lib/block-processor.ts @@ -49,9 +49,11 @@ const TXN_EVENT_SUBTYPE_VERSION_TO_VALIDATOR_MAPPING: Record'id')::bigint; + perpetual_market_record."clobPairId" = (event_data->'clobPairId')::bigint; + perpetual_market_record."ticker" = event_data->>'ticker'; + perpetual_market_record."marketId" = (event_data->'marketId')::integer; + perpetual_market_record."status" = dydx_clob_pair_status_to_market_status(event_data->'status'); + perpetual_market_record."priceChange24H" = 0; + perpetual_market_record."trades24H" = 0; + perpetual_market_record."volume24H" = 0; + perpetual_market_record."nextFundingRate" = 0; + perpetual_market_record."openInterest"= 0; + perpetual_market_record."quantumConversionExponent" = (event_data->'quantumConversionExponent')::integer; + perpetual_market_record."atomicResolution" = (event_data->'atomicResolution')::integer; + perpetual_market_record."subticksPerTick" = (event_data->'subticksPerTick')::integer; + perpetual_market_record."stepBaseQuantums" = dydx_from_jsonlib_long(event_data->'stepBaseQuantums'); + perpetual_market_record."liquidityTierId" = (event_data->'liquidityTier')::integer; + perpetual_market_record."marketType" = dydx_protocol_market_type_to_perpetual_market_type(event_data->'marketType'); + perpetual_market_record."baseOpenInterest" = 0; + perpetual_market_record."defaultFundingRate1H" = dydx_trim_scale( + power(10, PPM_EXPONENT) / + FUNDING_RATE_FROM_PROTOCOL_IN_HOURS * + (event_data->'defaultFunding8hrPpm')::numeric); + + INSERT INTO perpetual_markets VALUES (perpetual_market_record.*) RETURNING * INTO perpetual_market_record; + + RETURN jsonb_build_object( + 'perpetual_market', + dydx_to_jsonb(perpetual_market_record) + ); +END; +$$ LANGUAGE plpgsql; diff --git a/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v2_handler.sql b/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v2_handler.sql index 202ac39572e..cdbd5502036 100644 --- a/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v2_handler.sql +++ b/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v2_handler.sql @@ -1,5 +1,6 @@ CREATE OR REPLACE FUNCTION dydx_update_perpetual_v2_handler(event_data jsonb) RETURNS jsonb AS $$ -/** +/* + Deprecated; use `dydx_update_perpetual_v3_handler` instead. Parameters: - event_data: The 'data' field of the IndexerTendermintEvent (https://github.com/dydxprotocol/v4-chain/blob/9ed26bd/proto/dydxprotocol/indexer/indexer_manager/event.proto#L25) converted to JSON format. Conversion to JSON is expected to be done by JSON.stringify. diff --git a/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v3_handler.sql b/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v3_handler.sql new file mode 100644 index 00000000000..7b256db073a --- /dev/null +++ b/indexer/services/ender/src/scripts/handlers/dydx_update_perpetual_v3_handler.sql @@ -0,0 +1,47 @@ +CREATE OR REPLACE FUNCTION dydx_update_perpetual_v3_handler(event_data jsonb) RETURNS jsonb AS $$ +/** + Parameters: + - event_data: The 'data' field of the IndexerTendermintEvent (https://github.com/dydxprotocol/v4-chain/blob/9ed26bd/proto/dydxprotocol/indexer/indexer_manager/event.proto#L25) + converted to JSON format. Conversion to JSON is expected to be done by JSON.stringify. + Returns: JSON object containing fields: + - perpetual_market: The updated perpetual market in perpetual-market-model format (https://github.com/dydxprotocol/v4-chain/blob/9ed26bd/indexer/packages/postgres/src/models/perpetual-market-model.ts). + + (Note that no text should exist before the function declaration to ensure that exception line numbers are correct.) +*/ +DECLARE + PPM_EXPONENT constant numeric = -6; + FUNDING_RATE_FROM_PROTOCOL_IN_HOURS constant numeric = 8; + perpetual_market_id bigint; + perpetual_market_record perpetual_markets%ROWTYPE; +BEGIN + perpetual_market_id = (event_data->'id')::bigint; + perpetual_market_record."ticker" = event_data->>'ticker'; + perpetual_market_record."marketId" = (event_data->'marketId')::integer; + perpetual_market_record."atomicResolution" = (event_data->'atomicResolution')::integer; + perpetual_market_record."liquidityTierId" = (event_data->'liquidityTier')::integer; + perpetual_market_record."marketType" = dydx_protocol_market_type_to_perpetual_market_type(event_data->'marketType'); + perpetual_market_record."defaultFundingRate1H" = dydx_trim_scale( + power(10, PPM_EXPONENT) / + FUNDING_RATE_FROM_PROTOCOL_IN_HOURS * + (event_data->'defaultFunding8hrPpm')::numeric); + UPDATE perpetual_markets + SET + "ticker" = perpetual_market_record."ticker", + "marketId" = perpetual_market_record."marketId", + "atomicResolution" = perpetual_market_record."atomicResolution", + "liquidityTierId" = perpetual_market_record."liquidityTierId", + "marketType" = perpetual_market_record."marketType", + "defaultFundingRate1H" = perpetual_market_record."defaultFundingRate1H" + WHERE "id" = perpetual_market_id + RETURNING * INTO perpetual_market_record; + + IF NOT FOUND THEN + RAISE EXCEPTION 'Could not find perpetual market with corresponding id %', perpetual_market_id; + END IF; + + RETURN jsonb_build_object( + 'perpetual_market', + dydx_to_jsonb(perpetual_market_record) + ); +END; +$$ LANGUAGE plpgsql; \ No newline at end of file diff --git a/indexer/services/ender/src/validators/update-perpetual-validator.ts b/indexer/services/ender/src/validators/update-perpetual-validator.ts index 4bc50fe7449..670b87e76b9 100644 --- a/indexer/services/ender/src/validators/update-perpetual-validator.ts +++ b/indexer/services/ender/src/validators/update-perpetual-validator.ts @@ -1,12 +1,17 @@ import { perpetualMarketRefresher } from '@dydxprotocol-indexer/postgres'; -import { IndexerTendermintEvent, UpdatePerpetualEventV1, UpdatePerpetualEventV2 } from '@dydxprotocol-indexer/v4-protos'; +import { + IndexerTendermintEvent, + UpdatePerpetualEventV1, + UpdatePerpetualEventV2, + UpdatePerpetualEventV3, +} from '@dydxprotocol-indexer/v4-protos'; import { Handler } from '../handlers/handler'; import { UpdatePerpetualHandler } from '../handlers/update-perpetual-handler'; import { Validator } from './validator'; export class UpdatePerpetualValidator extends Validator< - UpdatePerpetualEventV1 | UpdatePerpetualEventV2 + UpdatePerpetualEventV1 | UpdatePerpetualEventV2 | UpdatePerpetualEventV3 > { public validate(): void { if (perpetualMarketRefresher.getPerpetualMarketFromId(this.event.id.toString()) === undefined) { diff --git a/indexer/services/roundtable/__tests__/helpers/pnl-ticks-helper.test.ts b/indexer/services/roundtable/__tests__/helpers/pnl-ticks-helper.test.ts index e962c0f0771..2352158f4bf 100644 --- a/indexer/services/roundtable/__tests__/helpers/pnl-ticks-helper.test.ts +++ b/indexer/services/roundtable/__tests__/helpers/pnl-ticks-helper.test.ts @@ -382,6 +382,7 @@ describe('pnl-ticks-helper', () => { liquidityTierId: 0, marketType: PerpetualMarketType.ISOLATED, baseOpenInterest: '100000', + defaultFundingRate1H: '0.0001', }); await perpetualMarketRefresher.updatePerpetualMarkets(); const positions2: PerpetualPositionFromDatabase[] = [ diff --git a/indexer/services/roundtable/src/lib/athena-ddl-tables/perpetual_markets.ts b/indexer/services/roundtable/src/lib/athena-ddl-tables/perpetual_markets.ts index 46cbd618c78..c27a1138dc0 100644 --- a/indexer/services/roundtable/src/lib/athena-ddl-tables/perpetual_markets.ts +++ b/indexer/services/roundtable/src/lib/athena-ddl-tables/perpetual_markets.ts @@ -22,7 +22,8 @@ const RAW_TABLE_COLUMNS: string = ` \`stepBaseQuantums\` int, \`liquidityTierId\` int, \`marketType\` string, - \`baseOpenInterest\` string + \`baseOpenInterest\` string, + \`defaultFundingRate1H\` string `; const TABLE_COLUMNS: string = ` "id", @@ -41,7 +42,8 @@ const TABLE_COLUMNS: string = ` "stepBaseQuantums", "liquidityTierId", "marketType", - ${castToDouble('baseOpenInterest')} + ${castToDouble('baseOpenInterest')}, + ${castToDouble('defaultFundingRate1H')} `; export function generateRawTable(tablePrefix: string, rdsExportIdentifier: string): string { diff --git a/indexer/services/roundtable/src/tasks/market-updater.ts b/indexer/services/roundtable/src/tasks/market-updater.ts index 306fc80c346..ab6d2ea30ec 100644 --- a/indexer/services/roundtable/src/tasks/market-updater.ts +++ b/indexer/services/roundtable/src/tasks/market-updater.ts @@ -70,6 +70,7 @@ export default async function runTask(): Promise { // TODO(DEC-1149 Add support for pulling information from candles FillTable.get24HourInformation(clobPairIds), PerpetualPositionTable.getOpenInterestLong(perpetualMarketIds), + // TODO(CT-1340): Need to add default funding rate to this value. NextFundingCache.getNextFunding(redisClient, tickers), ]); diff --git a/proto/dydxprotocol/indexer/events/events.proto b/proto/dydxprotocol/indexer/events/events.proto index 3568673e7d2..e3b3b10f208 100644 --- a/proto/dydxprotocol/indexer/events/events.proto +++ b/proto/dydxprotocol/indexer/events/events.proto @@ -374,7 +374,63 @@ message PerpetualMarketCreateEventV1 { // PerpetualMarketCreateEventV2 message contains all the information about a // new Perpetual Market on the dYdX chain. +// Deprecated. Use PerpetualMarketCreateEventV3 for the most up to date message message PerpetualMarketCreateEventV2 { + option deprecated = true; + + // Unique Perpetual id. + // Defined in perpetuals.perpetual + uint32 id = 1; + + // Unique clob pair Id associated with this perpetual market + // Defined in clob.clob_pair + uint32 clob_pair_id = 2; + + // The name of the `Perpetual` (e.g. `BTC-USD`). + // Defined in perpetuals.perpetual + string ticker = 3; + + // Unique id of market param associated with this perpetual market. + // Defined in perpetuals.perpetual + uint32 market_id = 4; + + // Status of the CLOB + dydxprotocol.indexer.protocol.v1.ClobPairStatus status = 5; + + // `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + // per Subtick. + // Defined in clob.clob_pair + sint32 quantum_conversion_exponent = 6; + + // The exponent for converting an atomic amount (`size = 1`) + // to a full coin. For example, if `AtomicResolution = -8` + // then a `PerpetualPosition` with `size = 1e8` is equivalent to + // a position size of one full coin. + // Defined in perpetuals.perpetual + sint32 atomic_resolution = 7; + + // Defines the tick size of the orderbook by defining how many subticks + // are in one tick. That is, the subticks of any valid order must be a + // multiple of this value. Generally this value should start `>= 100`to + // allow room for decreasing it. + // Defined in clob.clob_pair + uint32 subticks_per_tick = 8; + + // Minimum increment in the size of orders on the CLOB, in base quantums. + // Defined in clob.clob_pair + uint64 step_base_quantums = 9; + + // The liquidity_tier that this perpetual is associated with. + // Defined in perpetuals.perpetual + uint32 liquidity_tier = 10; + + // Market type of the perpetual. + dydxprotocol.indexer.protocol.v1.PerpetualMarketType market_type = 11; +} + +// PerpetualMarketCreateEventV3 message contains all the information about a +// new Perpetual Market on the dYdX chain. +message PerpetualMarketCreateEventV3 { // Unique Perpetual id. // Defined in perpetuals.perpetual uint32 id = 1; @@ -423,6 +479,9 @@ message PerpetualMarketCreateEventV2 { // Market type of the perpetual. dydxprotocol.indexer.protocol.v1.PerpetualMarketType market_type = 11; + + // Default 8hr funding rate in parts-per-million. + int32 default_funding8hr_ppm = 12; } // LiquidityTierUpsertEventV1 message contains all the information to @@ -490,6 +549,7 @@ message UpdateClobPairEventV1 { // for the event to update a perpetual. message UpdatePerpetualEventV1 { option deprecated = true; + // Unique Perpetual id. // Defined in perpetuals.perpetual uint32 id = 1; @@ -516,7 +576,10 @@ message UpdatePerpetualEventV1 { // UpdatePerpetualEventV2 message contains all the information about an update // to a perpetual on the dYdX chain. +// Deprecated. Use UpdatePerpetualEventV3. message UpdatePerpetualEventV2 { + option deprecated = true; + // Unique Perpetual id. // Defined in perpetuals.perpetual uint32 id = 1; @@ -544,6 +607,39 @@ message UpdatePerpetualEventV2 { dydxprotocol.indexer.protocol.v1.PerpetualMarketType market_type = 6; } +// UpdatePerpetualEventV3 message contains all the information about an update +// to a perpetual on the dYdX chain. +message UpdatePerpetualEventV3 { + // Unique Perpetual id. + // Defined in perpetuals.perpetual + uint32 id = 1; + + // The name of the `Perpetual` (e.g. `BTC-USD`). + // Defined in perpetuals.perpetual + string ticker = 2; + + // Unique id of market param associated with this perpetual market. + // Defined in perpetuals.perpetual + uint32 market_id = 3; + + // The exponent for converting an atomic amount (`size = 1`) + // to a full coin. For example, if `AtomicResolution = -8` + // then a `PerpetualPosition` with `size = 1e8` is equivalent to + // a position size of one full coin. + // Defined in perpetuals.perpetual + sint32 atomic_resolution = 4; + + // The liquidity_tier that this perpetual is associated with. + // Defined in perpetuals.perpetual + uint32 liquidity_tier = 5; + + // Market type of the perpetual. + dydxprotocol.indexer.protocol.v1.PerpetualMarketType market_type = 6; + + // Default 8hr funding rate in parts-per-million. + int32 default_funding8hr_ppm = 7; +} + // TradingRewardsEventV1 is communicates all trading rewards for all accounts // that receive trade rewards in the block. message TradingRewardsEventV1 { diff --git a/proto/dydxprotocol/perpetuals/perpetual.proto b/proto/dydxprotocol/perpetuals/perpetual.proto index cb5132ea0f3..eb7775b9153 100644 --- a/proto/dydxprotocol/perpetuals/perpetual.proto +++ b/proto/dydxprotocol/perpetuals/perpetual.proto @@ -55,7 +55,7 @@ message PerpetualParams { // a position size of one full coin. sint32 atomic_resolution = 4; - // The default funding payment if there is no price premium. In + // The default (8hr) funding payment if there is no price premium. In // parts-per-million. sint32 default_funding_ppm = 5; diff --git a/protocol/indexer/events/constants.go b/protocol/indexer/events/constants.go index f0a77cc1dd4..cf2d56eff1e 100644 --- a/protocol/indexer/events/constants.go +++ b/protocol/indexer/events/constants.go @@ -32,9 +32,9 @@ const ( FundingValuesEventVersion uint32 = 1 StatefulOrderEventVersion uint32 = 1 AssetEventVersion uint32 = 1 - PerpetualMarketEventVersion uint32 = 2 + PerpetualMarketEventVersion uint32 = 3 LiquidityTierEventVersion uint32 = 2 - UpdatePerpetualEventVersion uint32 = 2 + UpdatePerpetualEventVersion uint32 = 3 UpdateClobPairEventVersion uint32 = 1 DeleveragingEventVersion uint32 = 1 TradingRewardVersion uint32 = 1 diff --git a/protocol/indexer/events/events.pb.go b/protocol/indexer/events/events.pb.go index c7a34d5daba..61d4e03f889 100644 --- a/protocol/indexer/events/events.pb.go +++ b/protocol/indexer/events/events.pb.go @@ -1822,6 +1822,9 @@ func (m *PerpetualMarketCreateEventV1) GetLiquidityTier() uint32 { // PerpetualMarketCreateEventV2 message contains all the information about a // new Perpetual Market on the dYdX chain. +// Deprecated. Use PerpetualMarketCreateEventV3 for the most up to date message +// +// Deprecated: Do not use. type PerpetualMarketCreateEventV2 struct { // Unique Perpetual id. // Defined in perpetuals.perpetual @@ -1973,6 +1976,168 @@ func (m *PerpetualMarketCreateEventV2) GetMarketType() types.PerpetualMarketType return types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_UNSPECIFIED } +// PerpetualMarketCreateEventV3 message contains all the information about a +// new Perpetual Market on the dYdX chain. +type PerpetualMarketCreateEventV3 struct { + // Unique Perpetual id. + // Defined in perpetuals.perpetual + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // Unique clob pair Id associated with this perpetual market + // Defined in clob.clob_pair + ClobPairId uint32 `protobuf:"varint,2,opt,name=clob_pair_id,json=clobPairId,proto3" json:"clob_pair_id,omitempty"` + // The name of the `Perpetual` (e.g. `BTC-USD`). + // Defined in perpetuals.perpetual + Ticker string `protobuf:"bytes,3,opt,name=ticker,proto3" json:"ticker,omitempty"` + // Unique id of market param associated with this perpetual market. + // Defined in perpetuals.perpetual + MarketId uint32 `protobuf:"varint,4,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + // Status of the CLOB + Status types.ClobPairStatus `protobuf:"varint,5,opt,name=status,proto3,enum=dydxprotocol.indexer.protocol.v1.ClobPairStatus" json:"status,omitempty"` + // `10^Exponent` gives the number of QuoteQuantums traded per BaseQuantum + // per Subtick. + // Defined in clob.clob_pair + QuantumConversionExponent int32 `protobuf:"zigzag32,6,opt,name=quantum_conversion_exponent,json=quantumConversionExponent,proto3" json:"quantum_conversion_exponent,omitempty"` + // The exponent for converting an atomic amount (`size = 1`) + // to a full coin. For example, if `AtomicResolution = -8` + // then a `PerpetualPosition` with `size = 1e8` is equivalent to + // a position size of one full coin. + // Defined in perpetuals.perpetual + AtomicResolution int32 `protobuf:"zigzag32,7,opt,name=atomic_resolution,json=atomicResolution,proto3" json:"atomic_resolution,omitempty"` + // Defines the tick size of the orderbook by defining how many subticks + // are in one tick. That is, the subticks of any valid order must be a + // multiple of this value. Generally this value should start `>= 100`to + // allow room for decreasing it. + // Defined in clob.clob_pair + SubticksPerTick uint32 `protobuf:"varint,8,opt,name=subticks_per_tick,json=subticksPerTick,proto3" json:"subticks_per_tick,omitempty"` + // Minimum increment in the size of orders on the CLOB, in base quantums. + // Defined in clob.clob_pair + StepBaseQuantums uint64 `protobuf:"varint,9,opt,name=step_base_quantums,json=stepBaseQuantums,proto3" json:"step_base_quantums,omitempty"` + // The liquidity_tier that this perpetual is associated with. + // Defined in perpetuals.perpetual + LiquidityTier uint32 `protobuf:"varint,10,opt,name=liquidity_tier,json=liquidityTier,proto3" json:"liquidity_tier,omitempty"` + // Market type of the perpetual. + MarketType types.PerpetualMarketType `protobuf:"varint,11,opt,name=market_type,json=marketType,proto3,enum=dydxprotocol.indexer.protocol.v1.PerpetualMarketType" json:"market_type,omitempty"` + // Default 8hr funding rate in parts-per-million. + DefaultFunding8HrPpm int32 `protobuf:"varint,12,opt,name=default_funding8hr_ppm,json=defaultFunding8hrPpm,proto3" json:"default_funding8hr_ppm,omitempty"` +} + +func (m *PerpetualMarketCreateEventV3) Reset() { *m = PerpetualMarketCreateEventV3{} } +func (m *PerpetualMarketCreateEventV3) String() string { return proto.CompactTextString(m) } +func (*PerpetualMarketCreateEventV3) ProtoMessage() {} +func (*PerpetualMarketCreateEventV3) Descriptor() ([]byte, []int) { + return fileDescriptor_6331dfb59c6fd2bb, []int{17} +} +func (m *PerpetualMarketCreateEventV3) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PerpetualMarketCreateEventV3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PerpetualMarketCreateEventV3.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *PerpetualMarketCreateEventV3) XXX_Merge(src proto.Message) { + xxx_messageInfo_PerpetualMarketCreateEventV3.Merge(m, src) +} +func (m *PerpetualMarketCreateEventV3) XXX_Size() int { + return m.Size() +} +func (m *PerpetualMarketCreateEventV3) XXX_DiscardUnknown() { + xxx_messageInfo_PerpetualMarketCreateEventV3.DiscardUnknown(m) +} + +var xxx_messageInfo_PerpetualMarketCreateEventV3 proto.InternalMessageInfo + +func (m *PerpetualMarketCreateEventV3) GetId() uint32 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetClobPairId() uint32 { + if m != nil { + return m.ClobPairId + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +func (m *PerpetualMarketCreateEventV3) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetStatus() types.ClobPairStatus { + if m != nil { + return m.Status + } + return types.ClobPairStatus_CLOB_PAIR_STATUS_UNSPECIFIED +} + +func (m *PerpetualMarketCreateEventV3) GetQuantumConversionExponent() int32 { + if m != nil { + return m.QuantumConversionExponent + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetAtomicResolution() int32 { + if m != nil { + return m.AtomicResolution + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetSubticksPerTick() uint32 { + if m != nil { + return m.SubticksPerTick + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetStepBaseQuantums() uint64 { + if m != nil { + return m.StepBaseQuantums + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetLiquidityTier() uint32 { + if m != nil { + return m.LiquidityTier + } + return 0 +} + +func (m *PerpetualMarketCreateEventV3) GetMarketType() types.PerpetualMarketType { + if m != nil { + return m.MarketType + } + return types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_UNSPECIFIED +} + +func (m *PerpetualMarketCreateEventV3) GetDefaultFunding8HrPpm() int32 { + if m != nil { + return m.DefaultFunding8HrPpm + } + return 0 +} + // LiquidityTierUpsertEventV1 message contains all the information to // create/update a Liquidity Tier on the dYdX chain. type LiquidityTierUpsertEventV1 struct { @@ -1998,7 +2163,7 @@ func (m *LiquidityTierUpsertEventV1) Reset() { *m = LiquidityTierUpsertE func (m *LiquidityTierUpsertEventV1) String() string { return proto.CompactTextString(m) } func (*LiquidityTierUpsertEventV1) ProtoMessage() {} func (*LiquidityTierUpsertEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{17} + return fileDescriptor_6331dfb59c6fd2bb, []int{18} } func (m *LiquidityTierUpsertEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2090,7 +2255,7 @@ func (m *UpdateClobPairEventV1) Reset() { *m = UpdateClobPairEventV1{} } func (m *UpdateClobPairEventV1) String() string { return proto.CompactTextString(m) } func (*UpdateClobPairEventV1) ProtoMessage() {} func (*UpdateClobPairEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{18} + return fileDescriptor_6331dfb59c6fd2bb, []int{19} } func (m *UpdateClobPairEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2185,7 +2350,7 @@ func (m *UpdatePerpetualEventV1) Reset() { *m = UpdatePerpetualEventV1{} func (m *UpdatePerpetualEventV1) String() string { return proto.CompactTextString(m) } func (*UpdatePerpetualEventV1) ProtoMessage() {} func (*UpdatePerpetualEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{19} + return fileDescriptor_6331dfb59c6fd2bb, []int{20} } func (m *UpdatePerpetualEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2251,6 +2416,9 @@ func (m *UpdatePerpetualEventV1) GetLiquidityTier() uint32 { // UpdatePerpetualEventV2 message contains all the information about an update // to a perpetual on the dYdX chain. +// Deprecated. Use UpdatePerpetualEventV3. +// +// Deprecated: Do not use. type UpdatePerpetualEventV2 struct { // Unique Perpetual id. // Defined in perpetuals.perpetual @@ -2278,7 +2446,7 @@ func (m *UpdatePerpetualEventV2) Reset() { *m = UpdatePerpetualEventV2{} func (m *UpdatePerpetualEventV2) String() string { return proto.CompactTextString(m) } func (*UpdatePerpetualEventV2) ProtoMessage() {} func (*UpdatePerpetualEventV2) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{20} + return fileDescriptor_6331dfb59c6fd2bb, []int{21} } func (m *UpdatePerpetualEventV2) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2349,6 +2517,115 @@ func (m *UpdatePerpetualEventV2) GetMarketType() types.PerpetualMarketType { return types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_UNSPECIFIED } +// UpdatePerpetualEventV3 message contains all the information about an update +// to a perpetual on the dYdX chain. +type UpdatePerpetualEventV3 struct { + // Unique Perpetual id. + // Defined in perpetuals.perpetual + Id uint32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // The name of the `Perpetual` (e.g. `BTC-USD`). + // Defined in perpetuals.perpetual + Ticker string `protobuf:"bytes,2,opt,name=ticker,proto3" json:"ticker,omitempty"` + // Unique id of market param associated with this perpetual market. + // Defined in perpetuals.perpetual + MarketId uint32 `protobuf:"varint,3,opt,name=market_id,json=marketId,proto3" json:"market_id,omitempty"` + // The exponent for converting an atomic amount (`size = 1`) + // to a full coin. For example, if `AtomicResolution = -8` + // then a `PerpetualPosition` with `size = 1e8` is equivalent to + // a position size of one full coin. + // Defined in perpetuals.perpetual + AtomicResolution int32 `protobuf:"zigzag32,4,opt,name=atomic_resolution,json=atomicResolution,proto3" json:"atomic_resolution,omitempty"` + // The liquidity_tier that this perpetual is associated with. + // Defined in perpetuals.perpetual + LiquidityTier uint32 `protobuf:"varint,5,opt,name=liquidity_tier,json=liquidityTier,proto3" json:"liquidity_tier,omitempty"` + // Market type of the perpetual. + MarketType types.PerpetualMarketType `protobuf:"varint,6,opt,name=market_type,json=marketType,proto3,enum=dydxprotocol.indexer.protocol.v1.PerpetualMarketType" json:"market_type,omitempty"` + // Default 8hr funding rate in parts-per-million. + DefaultFunding8HrPpm int32 `protobuf:"varint,7,opt,name=default_funding8hr_ppm,json=defaultFunding8hrPpm,proto3" json:"default_funding8hr_ppm,omitempty"` +} + +func (m *UpdatePerpetualEventV3) Reset() { *m = UpdatePerpetualEventV3{} } +func (m *UpdatePerpetualEventV3) String() string { return proto.CompactTextString(m) } +func (*UpdatePerpetualEventV3) ProtoMessage() {} +func (*UpdatePerpetualEventV3) Descriptor() ([]byte, []int) { + return fileDescriptor_6331dfb59c6fd2bb, []int{22} +} +func (m *UpdatePerpetualEventV3) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *UpdatePerpetualEventV3) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_UpdatePerpetualEventV3.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *UpdatePerpetualEventV3) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdatePerpetualEventV3.Merge(m, src) +} +func (m *UpdatePerpetualEventV3) XXX_Size() int { + return m.Size() +} +func (m *UpdatePerpetualEventV3) XXX_DiscardUnknown() { + xxx_messageInfo_UpdatePerpetualEventV3.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdatePerpetualEventV3 proto.InternalMessageInfo + +func (m *UpdatePerpetualEventV3) GetId() uint32 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *UpdatePerpetualEventV3) GetTicker() string { + if m != nil { + return m.Ticker + } + return "" +} + +func (m *UpdatePerpetualEventV3) GetMarketId() uint32 { + if m != nil { + return m.MarketId + } + return 0 +} + +func (m *UpdatePerpetualEventV3) GetAtomicResolution() int32 { + if m != nil { + return m.AtomicResolution + } + return 0 +} + +func (m *UpdatePerpetualEventV3) GetLiquidityTier() uint32 { + if m != nil { + return m.LiquidityTier + } + return 0 +} + +func (m *UpdatePerpetualEventV3) GetMarketType() types.PerpetualMarketType { + if m != nil { + return m.MarketType + } + return types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_UNSPECIFIED +} + +func (m *UpdatePerpetualEventV3) GetDefaultFunding8HrPpm() int32 { + if m != nil { + return m.DefaultFunding8HrPpm + } + return 0 +} + // TradingRewardsEventV1 is communicates all trading rewards for all accounts // that receive trade rewards in the block. type TradingRewardsEventV1 struct { @@ -2360,7 +2637,7 @@ func (m *TradingRewardsEventV1) Reset() { *m = TradingRewardsEventV1{} } func (m *TradingRewardsEventV1) String() string { return proto.CompactTextString(m) } func (*TradingRewardsEventV1) ProtoMessage() {} func (*TradingRewardsEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{21} + return fileDescriptor_6331dfb59c6fd2bb, []int{23} } func (m *TradingRewardsEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2410,7 +2687,7 @@ func (m *AddressTradingReward) Reset() { *m = AddressTradingReward{} } func (m *AddressTradingReward) String() string { return proto.CompactTextString(m) } func (*AddressTradingReward) ProtoMessage() {} func (*AddressTradingReward) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{22} + return fileDescriptor_6331dfb59c6fd2bb, []int{24} } func (m *AddressTradingReward) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2458,7 +2735,7 @@ func (m *OpenInterestUpdateEventV1) Reset() { *m = OpenInterestUpdateEve func (m *OpenInterestUpdateEventV1) String() string { return proto.CompactTextString(m) } func (*OpenInterestUpdateEventV1) ProtoMessage() {} func (*OpenInterestUpdateEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{23} + return fileDescriptor_6331dfb59c6fd2bb, []int{25} } func (m *OpenInterestUpdateEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2508,7 +2785,7 @@ func (m *OpenInterestUpdate) Reset() { *m = OpenInterestUpdate{} } func (m *OpenInterestUpdate) String() string { return proto.CompactTextString(m) } func (*OpenInterestUpdate) ProtoMessage() {} func (*OpenInterestUpdate) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{24} + return fileDescriptor_6331dfb59c6fd2bb, []int{26} } func (m *OpenInterestUpdate) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2574,7 +2851,7 @@ func (m *LiquidityTierUpsertEventV2) Reset() { *m = LiquidityTierUpsertE func (m *LiquidityTierUpsertEventV2) String() string { return proto.CompactTextString(m) } func (*LiquidityTierUpsertEventV2) ProtoMessage() {} func (*LiquidityTierUpsertEventV2) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{25} + return fileDescriptor_6331dfb59c6fd2bb, []int{27} } func (m *LiquidityTierUpsertEventV2) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2665,7 +2942,7 @@ func (m *RegisterAffiliateEventV1) Reset() { *m = RegisterAffiliateEvent func (m *RegisterAffiliateEventV1) String() string { return proto.CompactTextString(m) } func (*RegisterAffiliateEventV1) ProtoMessage() {} func (*RegisterAffiliateEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{26} + return fileDescriptor_6331dfb59c6fd2bb, []int{28} } func (m *RegisterAffiliateEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2722,7 +2999,7 @@ func (m *UpsertVaultEventV1) Reset() { *m = UpsertVaultEventV1{} } func (m *UpsertVaultEventV1) String() string { return proto.CompactTextString(m) } func (*UpsertVaultEventV1) ProtoMessage() {} func (*UpsertVaultEventV1) Descriptor() ([]byte, []int) { - return fileDescriptor_6331dfb59c6fd2bb, []int{27} + return fileDescriptor_6331dfb59c6fd2bb, []int{29} } func (m *UpsertVaultEventV1) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2797,10 +3074,12 @@ func init() { proto.RegisterType((*AssetCreateEventV1)(nil), "dydxprotocol.indexer.events.AssetCreateEventV1") proto.RegisterType((*PerpetualMarketCreateEventV1)(nil), "dydxprotocol.indexer.events.PerpetualMarketCreateEventV1") proto.RegisterType((*PerpetualMarketCreateEventV2)(nil), "dydxprotocol.indexer.events.PerpetualMarketCreateEventV2") + proto.RegisterType((*PerpetualMarketCreateEventV3)(nil), "dydxprotocol.indexer.events.PerpetualMarketCreateEventV3") proto.RegisterType((*LiquidityTierUpsertEventV1)(nil), "dydxprotocol.indexer.events.LiquidityTierUpsertEventV1") proto.RegisterType((*UpdateClobPairEventV1)(nil), "dydxprotocol.indexer.events.UpdateClobPairEventV1") proto.RegisterType((*UpdatePerpetualEventV1)(nil), "dydxprotocol.indexer.events.UpdatePerpetualEventV1") proto.RegisterType((*UpdatePerpetualEventV2)(nil), "dydxprotocol.indexer.events.UpdatePerpetualEventV2") + proto.RegisterType((*UpdatePerpetualEventV3)(nil), "dydxprotocol.indexer.events.UpdatePerpetualEventV3") proto.RegisterType((*TradingRewardsEventV1)(nil), "dydxprotocol.indexer.events.TradingRewardsEventV1") proto.RegisterType((*AddressTradingReward)(nil), "dydxprotocol.indexer.events.AddressTradingReward") proto.RegisterType((*OpenInterestUpdateEventV1)(nil), "dydxprotocol.indexer.events.OpenInterestUpdateEventV1") @@ -2815,161 +3094,165 @@ func init() { } var fileDescriptor_6331dfb59c6fd2bb = []byte{ - // 2458 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcd, 0x6f, 0x23, 0x49, - 0x15, 0x4f, 0xdb, 0x8e, 0xe3, 0x3c, 0xc7, 0x19, 0xbb, 0xe2, 0x64, 0x9c, 0x04, 0x32, 0x43, 0x4b, - 0x48, 0xa3, 0xd9, 0x19, 0x67, 0x12, 0x76, 0x57, 0xab, 0x3d, 0x20, 0xe2, 0x7c, 0x6c, 0x1c, 0x25, - 0x19, 0x6f, 0xe7, 0x63, 0x77, 0x07, 0xb4, 0x4d, 0xa5, 0xbb, 0xec, 0x94, 0xd2, 0x5f, 0xd3, 0xdd, - 0xce, 0x4c, 0x06, 0x71, 0x43, 0x2c, 0x48, 0x48, 0x20, 0x21, 0x0e, 0x1c, 0x90, 0xb8, 0x70, 0x59, - 0x89, 0x03, 0x12, 0x70, 0xe3, 0x80, 0xb8, 0xec, 0x8d, 0x11, 0x27, 0x04, 0xd2, 0x0a, 0xcd, 0x1c, - 0xf8, 0x37, 0x50, 0x7d, 0x74, 0xfb, 0xdb, 0xf1, 0x4c, 0xb2, 0xd2, 0x0a, 0xed, 0x29, 0xae, 0xf7, - 0xea, 0xfd, 0xde, 0xab, 0xf7, 0x5e, 0x55, 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 0xc7, 0x5e, 0xaf, 0x58, 0x7c, 0xbf, 0xc8, 0x6e, 0x77, 0xb1, 0x33, 0x05, - 0x3c, 0x2e, 0xa6, 0xfe, 0x58, 0x81, 0x92, 0x46, 0x1a, 0x34, 0x08, 0x89, 0xbf, 0x16, 0x75, 0xac, - 0xa3, 0x2c, 0x5c, 0x85, 0x09, 0x9f, 0xd4, 0x89, 0x4f, 0x44, 0x03, 0x6a, 0xc8, 0x87, 0x29, 0x2d, - 0x9a, 0x88, 0xde, 0x86, 0xc9, 0xb8, 0xf3, 0x7d, 0xd9, 0xe7, 0x2c, 0xad, 0x35, 0x55, 0xfd, 0x83, - 0x02, 0x48, 0x84, 0xf3, 0x18, 0x37, 0xad, 0xb0, 0xcd, 0x84, 0xe8, 0xdb, 0xd8, 0xa5, 0x26, 0xc8, - 0x89, 0x23, 0x54, 0x96, 0x9b, 0xf1, 0xad, 0x99, 0xe4, 0x07, 0xdc, 0xfd, 0xcb, 0x0f, 0x38, 0x6e, - 0x55, 0xe7, 0x95, 0x59, 0xd1, 0x3e, 0x7b, 0xb1, 0xa4, 0x3c, 0x7f, 0xb1, 0xa4, 0xfc, 0xe7, 0xc5, - 0x92, 0xf2, 0x8b, 0x97, 0x4b, 0x63, 0xcf, 0x5f, 0x2e, 0x8d, 0xfd, 0xf3, 0xe5, 0xd2, 0xd8, 0xa3, - 0x77, 0x46, 0xcf, 0xfe, 0xce, 0xff, 0x37, 0x39, 0x49, 0x73, 0xc6, 0xb7, 0xfe, 0x17, 0x00, 0x00, - 0xff, 0xff, 0x24, 0x83, 0xff, 0xe5, 0x95, 0x22, 0x00, 0x00, + // 2516 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x5a, 0xcb, 0x6f, 0x23, 0xc7, + 0xd1, 0xd7, 0x90, 0x14, 0x49, 0x15, 0x45, 0x2d, 0xd9, 0xa2, 0xb4, 0x94, 0xf4, 0x7d, 0xda, 0xcd, + 0x00, 0x01, 0x16, 0x7e, 0x50, 0x2b, 0xf9, 0x01, 0xc3, 0x87, 0x20, 0xa2, 0x1e, 0x16, 0x05, 0x49, + 0x4b, 0x8f, 0x1e, 0xb6, 0x37, 0x81, 0x27, 0xad, 0x99, 0x26, 0xd5, 0xd0, 0xbc, 0x76, 0x66, 0xa8, + 0xb5, 0x36, 0xc8, 0x2d, 0x88, 0x73, 0x48, 0x90, 0x00, 0x39, 0xf9, 0x10, 0x20, 0x97, 0x5c, 0x0c, + 0xe4, 0x10, 0x20, 0xc9, 0x2d, 0x08, 0x82, 0x5c, 0x0c, 0xe4, 0x10, 0x23, 0xa7, 0x20, 0x01, 0x8c, + 0xc0, 0x7b, 0xc8, 0xbf, 0x11, 0xf4, 0x63, 0x86, 0x6f, 0x8a, 0xbb, 0x92, 0x01, 0x23, 0xf6, 0x49, + 0x9c, 0xaa, 0xae, 0x5f, 0x55, 0x57, 0x55, 0x77, 0x55, 0x77, 0x0b, 0xee, 0x99, 0x97, 0xe6, 0x07, + 0x9e, 0xef, 0x86, 0xae, 0xe1, 0x5a, 0x2b, 0xd4, 0x31, 0xc9, 0x07, 0xc4, 0x5f, 0x21, 0x17, 0xc4, + 0x09, 0x03, 0xf9, 0xa7, 0xc2, 0xd9, 0x68, 0xa9, 0x73, 0x64, 0x45, 0x8e, 0xac, 0x88, 0x21, 0x8b, + 0x0b, 0x86, 0x1b, 0xd8, 0x6e, 0xa0, 0x73, 0xfe, 0x8a, 0xf8, 0x10, 0x72, 0x8b, 0xa5, 0xa6, 0xdb, + 0x74, 0x05, 0x9d, 0xfd, 0x92, 0xd4, 0xfb, 0x03, 0xf5, 0x06, 0x67, 0xd8, 0x27, 0xe6, 0x8a, 0x4f, + 0x6c, 0xf7, 0x02, 0x5b, 0xba, 0x4f, 0x70, 0xe0, 0x3a, 0x52, 0xe2, 0xc5, 0x81, 0x12, 0x31, 0xe1, + 0x62, 0x75, 0xc5, 0xb0, 0xdc,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, 0x1d, 0x45, 0x90, + 0x83, 0x2d, 0x8a, 0xd9, 0xe8, 0x43, 0x05, 0x16, 0x2c, 0xd7, 0x69, 0xea, 0x21, 0xf1, 0xed, 0x3e, + 0x0f, 0x65, 0x9e, 0x37, 0x2d, 0xf6, 0x5c, 0xa7, 0x79, 0x44, 0x7c, 0x7b, 0x80, 0x7b, 0xe6, 0xad, + 0x81, 0x3c, 0xf4, 0x7d, 0x28, 0x46, 0xe9, 0xd1, 0x36, 0x20, 0xcb, 0x0d, 0xd8, 0xbb, 0xa6, 0x01, + 0x5a, 0x1b, 0x51, 0x74, 0x08, 0x6e, 0x0f, 0x75, 0xf1, 0x7b, 0x50, 0x1e, 0x96, 0xc9, 0x68, 0x33, + 0xea, 0x72, 0x9e, 0xab, 0x6d, 0x92, 0x3d, 0xce, 0xe2, 0x1f, 0x15, 0x98, 0x1f, 0x9c, 0xb7, 0xe8, + 0x21, 0x14, 0xf8, 0x92, 0x20, 0xa6, 0x0c, 0x40, 0xbc, 0xeb, 0xdd, 0x7f, 0x36, 0x5d, 0x35, 0x53, + 0x9b, 0x91, 0x48, 0xf2, 0x1b, 0xbd, 0x05, 0x69, 0x71, 0xc3, 0x23, 0x0f, 0xf8, 0x43, 0xfa, 0x29, + 0x71, 0x29, 0x54, 0xe9, 0x34, 0x4c, 0xe3, 0x62, 0x9a, 0x14, 0x5f, 0x34, 0x60, 0x69, 0x44, 0xda, + 0xdf, 0x90, 0x93, 0x7e, 0xd0, 0xaf, 0xa4, 0x23, 0x93, 0xd1, 0xfb, 0x80, 0xe2, 0xb5, 0x72, 0x7d, + 0x57, 0x15, 0x62, 0x2c, 0x49, 0x61, 0x59, 0x30, 0x2c, 0x71, 0x6f, 0x68, 0x82, 0x7f, 0x50, 0x60, + 0x71, 0x78, 0x6a, 0x22, 0x0d, 0xa6, 0x5d, 0xeb, 0x06, 0xa6, 0x06, 0xae, 0x15, 0x67, 0xc0, 0xe6, + 0xb5, 0x9a, 0x74, 0x69, 0x78,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24, 0x45, 0x59, 0xb8, 0x06, 0x19, 0x9f, + 0x34, 0x88, 0x4f, 0xc4, 0xc5, 0xf0, 0x88, 0x07, 0x63, 0x2d, 0x1a, 0x88, 0x5e, 0x87, 0xa9, 0xf8, + 0x45, 0xea, 0xaa, 0x67, 0x66, 0xad, 0x3d, 0x54, 0xfd, 0xad, 0x02, 0x48, 0x84, 0xf3, 0x84, 0xed, + 0x1e, 0x1d, 0x26, 0x44, 0x6f, 0xd6, 0x57, 0x9a, 0x20, 0x07, 0x8e, 0xd1, 0xd5, 0x6f, 0xc5, 0xbd, + 0x47, 0x92, 0x6f, 0x8b, 0x2f, 0x5f, 0xbd, 0x2d, 0x72, 0xab, 0xba, 0x1b, 0x8f, 0xaa, 0xf6, 0xc9, + 0xe7, 0xcb, 0xca, 0xa7, 0x9f, 0x2f, 0x2b, 0xff, 0xfe, 0x7c, 0x59, 0xf9, 0xf9, 0xd3, 0xe5, 0x89, + 0x4f, 0x9f, 0x2e, 0x4f, 0xfc, 0xe3, 0xe9, 0xf2, 0xc4, 0xc3, 0x37, 0xc6, 0xcf, 0xfe, 0xee, 0xff, + 0x03, 0x3b, 0x4d, 0x73, 0xc6, 0x2b, 0xff, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xaa, 0xcd, 0x8a, 0xca, + 0x2d, 0x26, 0x00, 0x00, } func (m *FundingUpdateV1) Marshal() (dAtA []byte, err error) { @@ -4356,7 +4639,7 @@ func (m *PerpetualMarketCreateEventV2) MarshalToSizedBuffer(dAtA []byte) (int, e return len(dAtA) - i, nil } -func (m *LiquidityTierUpsertEventV1) Marshal() (dAtA []byte, err error) { +func (m *PerpetualMarketCreateEventV3) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -4366,28 +4649,113 @@ func (m *LiquidityTierUpsertEventV1) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *LiquidityTierUpsertEventV1) MarshalTo(dAtA []byte) (int, error) { +func (m *PerpetualMarketCreateEventV3) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *LiquidityTierUpsertEventV1) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *PerpetualMarketCreateEventV3) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.BasePositionNotional != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.BasePositionNotional)) + if m.DefaultFunding8HrPpm != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.DefaultFunding8HrPpm)) i-- - dAtA[i] = 0x28 + dAtA[i] = 0x60 } - if m.MaintenanceFractionPpm != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.MaintenanceFractionPpm)) + if m.MarketType != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketType)) i-- - dAtA[i] = 0x20 + dAtA[i] = 0x58 } - if m.InitialMarginPpm != 0 { - i = encodeVarintEvents(dAtA, i, uint64(m.InitialMarginPpm)) + if m.LiquidityTier != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.LiquidityTier)) + i-- + dAtA[i] = 0x50 + } + if m.StepBaseQuantums != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.StepBaseQuantums)) + i-- + dAtA[i] = 0x48 + } + if m.SubticksPerTick != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.SubticksPerTick)) + i-- + dAtA[i] = 0x40 + } + if m.AtomicResolution != 0 { + i = encodeVarintEvents(dAtA, i, uint64((uint32(m.AtomicResolution)<<1)^uint32((m.AtomicResolution>>31)))) + i-- + dAtA[i] = 0x38 + } + if m.QuantumConversionExponent != 0 { + i = encodeVarintEvents(dAtA, i, uint64((uint32(m.QuantumConversionExponent)<<1)^uint32((m.QuantumConversionExponent>>31)))) + i-- + dAtA[i] = 0x30 + } + if m.Status != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Status)) + i-- + dAtA[i] = 0x28 + } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x20 + } + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0x1a + } + if m.ClobPairId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.ClobPairId)) + i-- + dAtA[i] = 0x10 + } + if m.Id != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *LiquidityTierUpsertEventV1) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *LiquidityTierUpsertEventV1) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *LiquidityTierUpsertEventV1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.BasePositionNotional != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.BasePositionNotional)) + i-- + dAtA[i] = 0x28 + } + if m.MaintenanceFractionPpm != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MaintenanceFractionPpm)) + i-- + dAtA[i] = 0x20 + } + if m.InitialMarginPpm != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.InitialMarginPpm)) i-- dAtA[i] = 0x18 } @@ -4559,6 +4927,66 @@ func (m *UpdatePerpetualEventV2) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *UpdatePerpetualEventV3) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *UpdatePerpetualEventV3) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *UpdatePerpetualEventV3) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.DefaultFunding8HrPpm != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.DefaultFunding8HrPpm)) + i-- + dAtA[i] = 0x38 + } + if m.MarketType != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketType)) + i-- + dAtA[i] = 0x30 + } + if m.LiquidityTier != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.LiquidityTier)) + i-- + dAtA[i] = 0x28 + } + if m.AtomicResolution != 0 { + i = encodeVarintEvents(dAtA, i, uint64((uint32(m.AtomicResolution)<<1)^uint32((m.AtomicResolution>>31)))) + i-- + dAtA[i] = 0x20 + } + if m.MarketId != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.MarketId)) + i-- + dAtA[i] = 0x18 + } + if len(m.Ticker) > 0 { + i -= len(m.Ticker) + copy(dAtA[i:], m.Ticker) + i = encodeVarintEvents(dAtA, i, uint64(len(m.Ticker))) + i-- + dAtA[i] = 0x12 + } + if m.Id != 0 { + i = encodeVarintEvents(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + func (m *TradingRewardsEventV1) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5479,6 +5907,52 @@ func (m *PerpetualMarketCreateEventV2) Size() (n int) { return n } +func (m *PerpetualMarketCreateEventV3) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovEvents(uint64(m.Id)) + } + if m.ClobPairId != 0 { + n += 1 + sovEvents(uint64(m.ClobPairId)) + } + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } + if m.Status != 0 { + n += 1 + sovEvents(uint64(m.Status)) + } + if m.QuantumConversionExponent != 0 { + n += 1 + sozEvents(uint64(m.QuantumConversionExponent)) + } + if m.AtomicResolution != 0 { + n += 1 + sozEvents(uint64(m.AtomicResolution)) + } + if m.SubticksPerTick != 0 { + n += 1 + sovEvents(uint64(m.SubticksPerTick)) + } + if m.StepBaseQuantums != 0 { + n += 1 + sovEvents(uint64(m.StepBaseQuantums)) + } + if m.LiquidityTier != 0 { + n += 1 + sovEvents(uint64(m.LiquidityTier)) + } + if m.MarketType != 0 { + n += 1 + sovEvents(uint64(m.MarketType)) + } + if m.DefaultFunding8HrPpm != 0 { + n += 1 + sovEvents(uint64(m.DefaultFunding8HrPpm)) + } + return n +} + func (m *LiquidityTierUpsertEventV1) Size() (n int) { if m == nil { return 0 @@ -5581,6 +6055,37 @@ func (m *UpdatePerpetualEventV2) Size() (n int) { return n } +func (m *UpdatePerpetualEventV3) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Id != 0 { + n += 1 + sovEvents(uint64(m.Id)) + } + l = len(m.Ticker) + if l > 0 { + n += 1 + l + sovEvents(uint64(l)) + } + if m.MarketId != 0 { + n += 1 + sovEvents(uint64(m.MarketId)) + } + if m.AtomicResolution != 0 { + n += 1 + sozEvents(uint64(m.AtomicResolution)) + } + if m.LiquidityTier != 0 { + n += 1 + sovEvents(uint64(m.LiquidityTier)) + } + if m.MarketType != 0 { + n += 1 + sovEvents(uint64(m.MarketType)) + } + if m.DefaultFunding8HrPpm != 0 { + n += 1 + sovEvents(uint64(m.DefaultFunding8HrPpm)) + } + return n +} + func (m *TradingRewardsEventV1) Size() (n int) { if m == nil { return 0 @@ -9165,7 +9670,7 @@ func (m *PerpetualMarketCreateEventV2) Unmarshal(dAtA []byte) error { } return nil } -func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { +func (m *PerpetualMarketCreateEventV3) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -9188,10 +9693,10 @@ func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: LiquidityTierUpsertEventV1: wiretype end group for non-group") + return fmt.Errorf("proto: PerpetualMarketCreateEventV3: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: LiquidityTierUpsertEventV1: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: PerpetualMarketCreateEventV3: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -9214,8 +9719,27 @@ func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { } } case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ClobPairId", wireType) + } + m.ClobPairId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ClobPairId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -9243,13 +9767,13 @@ func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Name = string(dAtA[iNdEx:postIndex]) + m.Ticker = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex - case 3: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field InitialMarginPpm", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) } - m.InitialMarginPpm = 0 + m.MarketId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -9259,16 +9783,16 @@ func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.InitialMarginPpm |= uint32(b&0x7F) << shift + m.MarketId |= uint32(b&0x7F) << shift if b < 0x80 { break } } - case 4: + case 5: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaintenanceFractionPpm", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Status", wireType) } - m.MaintenanceFractionPpm = 0 + m.Status = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowEvents @@ -9278,14 +9802,290 @@ func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.MaintenanceFractionPpm |= uint32(b&0x7F) << shift + m.Status |= types.ClobPairStatus(b&0x7F) << shift if b < 0x80 { break } } - case 5: + case 6: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BasePositionNotional", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field QuantumConversionExponent", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.QuantumConversionExponent = v + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AtomicResolution", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.AtomicResolution = v + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SubticksPerTick", wireType) + } + m.SubticksPerTick = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SubticksPerTick |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field StepBaseQuantums", wireType) + } + m.StepBaseQuantums = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.StepBaseQuantums |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidityTier", wireType) + } + m.LiquidityTier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LiquidityTier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketType", wireType) + } + m.MarketType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketType |= types.PerpetualMarketType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultFunding8HrPpm", wireType) + } + m.DefaultFunding8HrPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DefaultFunding8HrPpm |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *LiquidityTierUpsertEventV1) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: LiquidityTierUpsertEventV1: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: LiquidityTierUpsertEventV1: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Name = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field InitialMarginPpm", wireType) + } + m.InitialMarginPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.InitialMarginPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MaintenanceFractionPpm", wireType) + } + m.MaintenanceFractionPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MaintenanceFractionPpm |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BasePositionNotional", wireType) } m.BasePositionNotional = 0 for shift := uint(0); ; shift += 7 { @@ -9809,6 +10609,204 @@ func (m *UpdatePerpetualEventV2) Unmarshal(dAtA []byte) error { } return nil } +func (m *UpdatePerpetualEventV3) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: UpdatePerpetualEventV3: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: UpdatePerpetualEventV3: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ticker", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthEvents + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthEvents + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ticker = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketId", wireType) + } + m.MarketId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AtomicResolution", wireType) + } + var v int32 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + v = int32((uint32(v) >> 1) ^ uint32(((v&1)<<31)>>31)) + m.AtomicResolution = v + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LiquidityTier", wireType) + } + m.LiquidityTier = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LiquidityTier |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MarketType", wireType) + } + m.MarketType = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.MarketType |= types.PerpetualMarketType(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field DefaultFunding8HrPpm", wireType) + } + m.DefaultFunding8HrPpm = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowEvents + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.DefaultFunding8HrPpm |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipEvents(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthEvents + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *TradingRewardsEventV1) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/protocol/indexer/events/perpetual.go b/protocol/indexer/events/perpetual.go index c6a5db40a2f..c3f2327b051 100644 --- a/protocol/indexer/events/perpetual.go +++ b/protocol/indexer/events/perpetual.go @@ -5,7 +5,7 @@ import ( perptypes "github.com/dydxprotocol/v4-chain/protocol/x/perpetuals/types" ) -// NewUpdatePerpetualEvent creates a UpdatePerpetualEventV2 representing +// NewUpdatePerpetualEvent creates a UpdatePerpetualEventV3 representing // update of a perpetual. func NewUpdatePerpetualEvent( id uint32, @@ -14,13 +14,15 @@ func NewUpdatePerpetualEvent( atomicResolution int32, liquidityTier uint32, marketType perptypes.PerpetualMarketType, -) *UpdatePerpetualEventV2 { - return &UpdatePerpetualEventV2{ - Id: id, - Ticker: ticker, - MarketId: marketId, - AtomicResolution: atomicResolution, - LiquidityTier: liquidityTier, - MarketType: v1.ConvertToPerpetualMarketType(marketType), + defaultFundingPpm int32, +) *UpdatePerpetualEventV3 { + return &UpdatePerpetualEventV3{ + Id: id, + Ticker: ticker, + MarketId: marketId, + AtomicResolution: atomicResolution, + LiquidityTier: liquidityTier, + MarketType: v1.ConvertToPerpetualMarketType(marketType), + DefaultFunding8HrPpm: defaultFundingPpm, } } diff --git a/protocol/indexer/events/perpetual_market_create.go b/protocol/indexer/events/perpetual_market_create.go index 6e0314da4e7..fac5be24296 100644 --- a/protocol/indexer/events/perpetual_market_create.go +++ b/protocol/indexer/events/perpetual_market_create.go @@ -20,8 +20,9 @@ func NewPerpetualMarketCreateEvent( stepBaseQuantums uint64, liquidityTier uint32, marketType perptypes.PerpetualMarketType, -) *PerpetualMarketCreateEventV2 { - return &PerpetualMarketCreateEventV2{ + defaultFundingPpm int32, +) *PerpetualMarketCreateEventV3 { + return &PerpetualMarketCreateEventV3{ Id: id, ClobPairId: clobPairId, Ticker: ticker, @@ -33,5 +34,6 @@ func NewPerpetualMarketCreateEvent( StepBaseQuantums: stepBaseQuantums, LiquidityTier: liquidityTier, MarketType: v1.ConvertToPerpetualMarketType(marketType), + DefaultFunding8HrPpm: defaultFundingPpm, } } diff --git a/protocol/indexer/events/perpetual_market_create_test.go b/protocol/indexer/events/perpetual_market_create_test.go index 7a8e1e15ac9..e0ad02b042b 100644 --- a/protocol/indexer/events/perpetual_market_create_test.go +++ b/protocol/indexer/events/perpetual_market_create_test.go @@ -23,8 +23,9 @@ func TestNewPerpetualMarketCreateEvent_Success(t *testing.T) { 5, 0, perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, + 100, ) - expectedPerpetualMarketCreateEventProto := &PerpetualMarketCreateEventV2{ + expectedPerpetualMarketCreateEventProto := &PerpetualMarketCreateEventV3{ Id: 0, ClobPairId: 0, Ticker: "BTC", @@ -36,6 +37,7 @@ func TestNewPerpetualMarketCreateEvent_Success(t *testing.T) { StepBaseQuantums: 5, LiquidityTier: 0, MarketType: v1types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, + DefaultFunding8HrPpm: 100, } require.Equal(t, expectedPerpetualMarketCreateEventProto, perpetualMarketCreateEvent) } diff --git a/protocol/indexer/events/perpetual_test.go b/protocol/indexer/events/perpetual_test.go index 2c9a7cb300c..c8ff233b699 100644 --- a/protocol/indexer/events/perpetual_test.go +++ b/protocol/indexer/events/perpetual_test.go @@ -17,14 +17,16 @@ func TestNewUpdatePerpetualEvent_Success(t *testing.T) { -8, 2, perptypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, + 100, // defaultFundingPpm ) - expectedUpdatePerpetualEventProto := &UpdatePerpetualEventV2{ - Id: 5, - Ticker: "BTC-ETH", - MarketId: 5, - AtomicResolution: -8, - LiquidityTier: 2, - MarketType: v1types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, + expectedUpdatePerpetualEventProto := &UpdatePerpetualEventV3{ + Id: 5, + Ticker: "BTC-ETH", + MarketId: 5, + AtomicResolution: -8, + LiquidityTier: 2, + MarketType: v1types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, + DefaultFunding8HrPpm: 100, } require.Equal(t, expectedUpdatePerpetualEventProto, updatePerpetualEvent) } diff --git a/protocol/testutil/keeper/clob.go b/protocol/testutil/keeper/clob.go index 661d901d623..78bac5c9943 100644 --- a/protocol/testutil/keeper/clob.go +++ b/protocol/testutil/keeper/clob.go @@ -348,6 +348,7 @@ func CreateNClobPair( items[i].StepBaseQuantums, perps[i].Params.LiquidityTier, perps[i].Params.MarketType, + perps[i].Params.DefaultFundingPpm, ), ), ).Return() diff --git a/protocol/x/clob/abci_test.go b/protocol/x/clob/abci_test.go index 2fdbf5e8e40..0f49eed986e 100644 --- a/protocol/x/clob/abci_test.go +++ b/protocol/x/clob/abci_test.go @@ -527,6 +527,7 @@ func TestEndBlocker_Success(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.BtcUsd_20PercentInitial_10PercentMaintenance.Params.LiquidityTier, constants.BtcUsd_20PercentInitial_10PercentMaintenance.Params.MarketType, + constants.BtcUsd_20PercentInitial_10PercentMaintenance.Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -559,7 +560,8 @@ func TestEndBlocker_Success(t *testing.T) { constants.ClobPair_Eth.SubticksPerTick, constants.ClobPair_Eth.StepBaseQuantums, constants.EthUsd_20PercentInitial_10PercentMaintenance.Params.LiquidityTier, - constants.BtcUsd_20PercentInitial_10PercentMaintenance.Params.MarketType, + constants.EthUsd_20PercentInitial_10PercentMaintenance.Params.MarketType, + constants.EthUsd_20PercentInitial_10PercentMaintenance.Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/genesis_test.go b/protocol/x/clob/genesis_test.go index 7ba45b34dd2..02d770f5a48 100644 --- a/protocol/x/clob/genesis_test.go +++ b/protocol/x/clob/genesis_test.go @@ -453,6 +453,7 @@ func TestGenesis(t *testing.T) { clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/keeper/clob_pair.go b/protocol/x/clob/keeper/clob_pair.go index cc1cd449d62..d8209e7483c 100644 --- a/protocol/x/clob/keeper/clob_pair.go +++ b/protocol/x/clob/keeper/clob_pair.go @@ -161,6 +161,7 @@ func (k Keeper) createPerpetualClobPair( clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ) diff --git a/protocol/x/clob/keeper/clob_pair_test.go b/protocol/x/clob/keeper/clob_pair_test.go index cff3f32be57..8f8955f4433 100644 --- a/protocol/x/clob/keeper/clob_pair_test.go +++ b/protocol/x/clob/keeper/clob_pair_test.go @@ -67,6 +67,7 @@ func TestCreatePerpetualClobPairAndMemStructs_MultiplePerpetual(t *testing.T) { clobPair.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[i].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[i].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[i].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -190,6 +191,7 @@ func TestCreatePerpetualClobPairAndMemStructs_FailsWithDuplicateClobPairId(t *te clobPair.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -283,6 +285,7 @@ func TestCreatePerpetualClobPairAndMemStructs(t *testing.T) { tc.clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ).Return() @@ -437,6 +440,7 @@ func TestCreateMultipleClobPairs(t *testing.T) { make.clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ).Return() @@ -631,6 +635,7 @@ func TestUpdateClobPair_FinalSettlement(t *testing.T) { clobPair.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -740,6 +745,7 @@ func TestUpdateClobPair(t *testing.T) { clobPair.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -798,6 +804,7 @@ func TestUpdateClobPair(t *testing.T) { clobPair.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -836,6 +843,7 @@ func TestUpdateClobPair(t *testing.T) { clobPair.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/keeper/deleveraging_test.go b/protocol/x/clob/keeper/deleveraging_test.go index f36f7300618..4f2e8b50512 100644 --- a/protocol/x/clob/keeper/deleveraging_test.go +++ b/protocol/x/clob/keeper/deleveraging_test.go @@ -285,6 +285,7 @@ func TestCanDeleverageSubaccount(t *testing.T) { clobPair.StepBaseQuantums, perpetuals[i].Params.LiquidityTier, perpetuals[i].Params.MarketType, + perpetuals[i].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -682,6 +683,7 @@ func TestOffsetSubaccountPerpetualPosition(t *testing.T) { clobPair.StepBaseQuantums, perps[i].Params.LiquidityTier, perps[i].Params.MarketType, + perps[i].Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/keeper/get_price_premium_test.go b/protocol/x/clob/keeper/get_price_premium_test.go index f75e1c8c150..b3653d58f2a 100644 --- a/protocol/x/clob/keeper/get_price_premium_test.go +++ b/protocol/x/clob/keeper/get_price_premium_test.go @@ -185,6 +185,7 @@ func TestGetPricePremiumForPerpetual(t *testing.T) { tc.args.clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ).Return() diff --git a/protocol/x/clob/keeper/liquidations_test.go b/protocol/x/clob/keeper/liquidations_test.go index 2b21a212810..3c44e3d6d7a 100644 --- a/protocol/x/clob/keeper/liquidations_test.go +++ b/protocol/x/clob/keeper/liquidations_test.go @@ -1250,6 +1250,7 @@ func TestPlacePerpetualLiquidation_PreexistingLiquidation(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.BtcUsd_100PercentMarginRequirement.Params.LiquidityTier, constants.BtcUsd_100PercentMarginRequirement.Params.MarketType, + constants.BtcUsd_100PercentMarginRequirement.Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -1280,6 +1281,7 @@ func TestPlacePerpetualLiquidation_PreexistingLiquidation(t *testing.T) { constants.ClobPair_Eth.StepBaseQuantums, constants.EthUsd_100PercentMarginRequirement.Params.LiquidityTier, constants.EthUsd_100PercentMarginRequirement.Params.MarketType, + constants.EthUsd_100PercentMarginRequirement.Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -2190,6 +2192,7 @@ func TestPlacePerpetualLiquidation_Deleveraging(t *testing.T) { clobPair.StepBaseQuantums, perpetuals[i].Params.LiquidityTier, perpetuals[i].Params.MarketType, + perpetuals[i].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -2310,6 +2313,7 @@ func TestPlacePerpetualLiquidation_SendOffchainMessages(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -3849,6 +3853,7 @@ func TestGetLiquidationInsuranceFundDelta(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, tc.perpetuals[0].Params.LiquidityTier, tc.perpetuals[0].Params.MarketType, + tc.perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -4597,6 +4602,7 @@ func TestGetPerpetualPositionToLiquidate(t *testing.T) { clobPair.StepBaseQuantums, tc.perpetuals[perpetualId].Params.LiquidityTier, tc.perpetuals[perpetualId].Params.MarketType, + tc.perpetuals[perpetualId].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -5178,6 +5184,7 @@ func TestGetMaxAndMinPositionNotionalLiquidatable(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.BtcUsd_100PercentMarginRequirement.Params.LiquidityTier, constants.BtcUsd_100PercentMarginRequirement.Params.MarketType, + constants.BtcUsd_100PercentMarginRequirement.Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -5333,6 +5340,7 @@ func TestSortLiquidationOrders(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.BtcUsd_100PercentMarginRequirement.Params.LiquidityTier, constants.BtcUsd_100PercentMarginRequirement.Params.MarketType, + constants.BtcUsd_100PercentMarginRequirement.Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/keeper/msg_server_create_clob_pair_test.go b/protocol/x/clob/keeper/msg_server_create_clob_pair_test.go index bbb64676a16..6f924424a10 100644 --- a/protocol/x/clob/keeper/msg_server_create_clob_pair_test.go +++ b/protocol/x/clob/keeper/msg_server_create_clob_pair_test.go @@ -64,6 +64,7 @@ func TestCreateClobPair(t *testing.T) { testClobPair1.StepBaseQuantums, testPerp1.Params.LiquidityTier, testPerp1.Params.MarketType, + testPerp1.Params.DefaultFundingPpm, ), ), ).Return() diff --git a/protocol/x/clob/keeper/msg_server_place_order_test.go b/protocol/x/clob/keeper/msg_server_place_order_test.go index f7f0785c417..05193ad0083 100644 --- a/protocol/x/clob/keeper/msg_server_place_order_test.go +++ b/protocol/x/clob/keeper/msg_server_place_order_test.go @@ -183,6 +183,7 @@ func TestPlaceOrder_Error(t *testing.T) { clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -334,6 +335,7 @@ func TestPlaceOrder_Success(t *testing.T) { clobPair.StepBaseQuantums, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/keeper/orders_test.go b/protocol/x/clob/keeper/orders_test.go index 09d20259180..35d0f72591c 100644 --- a/protocol/x/clob/keeper/orders_test.go +++ b/protocol/x/clob/keeper/orders_test.go @@ -979,6 +979,7 @@ func TestPlaceOrder_SendOffchainMessages(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -1036,6 +1037,7 @@ func TestPerformStatefulOrderValidation_PreExistingStatefulOrder(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -1793,6 +1795,7 @@ func TestGetStatePosition_Success(t *testing.T) { cp.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[i].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[i].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[i].Params.DefaultFundingPpm, ), ), ).Once().Return() @@ -2011,6 +2014,7 @@ func TestInitStatefulOrders(t *testing.T) { constants.ClobPair_Btc.StepBaseQuantums, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/keeper/process_operations_test.go b/protocol/x/clob/keeper/process_operations_test.go index 7ea9f4cca4a..8664f008004 100644 --- a/protocol/x/clob/keeper/process_operations_test.go +++ b/protocol/x/clob/keeper/process_operations_test.go @@ -2456,6 +2456,7 @@ func setupProcessProposerOperationsTestCase( clobPair.StepBaseQuantums, tc.perpetuals[perpetualId].Params.LiquidityTier, tc.perpetuals[perpetualId].Params.MarketType, + tc.perpetuals[perpetualId].Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/clob/module_test.go b/protocol/x/clob/module_test.go index ce1793e1cbc..5373670a481 100644 --- a/protocol/x/clob/module_test.go +++ b/protocol/x/clob/module_test.go @@ -310,6 +310,7 @@ func TestAppModule_InitExportGenesis(t *testing.T) { uint64(5), constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.LiquidityTier, constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.MarketType, + constants.Perpetuals_DefaultGenesisState.Perpetuals[0].Params.DefaultFundingPpm, ), ), ).Once().Return() diff --git a/protocol/x/listing/keeper/listing.go b/protocol/x/listing/keeper/listing.go index 7518ea346f8..68ca344e7f6 100644 --- a/protocol/x/listing/keeper/listing.go +++ b/protocol/x/listing/keeper/listing.go @@ -203,6 +203,7 @@ func (k Keeper) UpgradeIsolatedPerpetualToCross( perpetual.Params.AtomicResolution, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ) diff --git a/protocol/x/listing/keeper/msg_server_upgrade_isolated_perpetual_to_cross_test.go b/protocol/x/listing/keeper/msg_server_upgrade_isolated_perpetual_to_cross_test.go index bf27627a577..466c5e127cf 100644 --- a/protocol/x/listing/keeper/msg_server_upgrade_isolated_perpetual_to_cross_test.go +++ b/protocol/x/listing/keeper/msg_server_upgrade_isolated_perpetual_to_cross_test.go @@ -227,16 +227,19 @@ func TestMsgUpgradeIsolatedPerpetualToCross(t *testing.T) { // Verify that expected indexer event was emitted. perpetual, err = perpetualsKeeper.GetPerpetual(ctx, tc.msg.PerpetualId) require.NoError(t, err) - expectedIndexerEvent := &indexerevents.UpdatePerpetualEventV2{ + expectedIndexerEvent := &indexerevents.UpdatePerpetualEventV3{ Id: perpetual.Params.Id, Ticker: perpetual.Params.Ticker, MarketId: perpetual.Params.MarketId, AtomicResolution: perpetual.Params.AtomicResolution, LiquidityTier: perpetual.Params.LiquidityTier, - MarketType: v1.ConvertToPerpetualMarketType(perpetualtypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS), + MarketType: v1.ConvertToPerpetualMarketType( + perpetualtypes.PerpetualMarketType_PERPETUAL_MARKET_TYPE_CROSS, + ), + DefaultFunding8HrPpm: perpetual.Params.DefaultFundingPpm, } emittedIndexerEvents := getUpdatePerpetualEventsFromIndexerBlock(ctx, keeper) - require.Equal(t, emittedIndexerEvents, []*indexerevents.UpdatePerpetualEventV2{expectedIndexerEvent}) + require.Equal(t, emittedIndexerEvents, []*indexerevents.UpdatePerpetualEventV3{expectedIndexerEvent}) }, ) } @@ -246,15 +249,15 @@ func TestMsgUpgradeIsolatedPerpetualToCross(t *testing.T) { func getUpdatePerpetualEventsFromIndexerBlock( ctx sdk.Context, listingKeeper *listingkeeper.Keeper, -) []*indexerevents.UpdatePerpetualEventV2 { +) []*indexerevents.UpdatePerpetualEventV3 { block := listingKeeper.GetIndexerEventManager().ProduceBlock(ctx) - var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV2 + var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV3 for _, event := range block.Events { if event.Subtype != indexerevents.SubtypeUpdatePerpetual { continue } if _, ok := event.OrderingWithinBlock.(*indexer_manager.IndexerTendermintEvent_TransactionIndex); ok { - var updatePerpetualEvent indexerevents.UpdatePerpetualEventV2 + var updatePerpetualEvent indexerevents.UpdatePerpetualEventV3 err := proto.Unmarshal(event.DataBytes, &updatePerpetualEvent) if err != nil { panic(err) diff --git a/protocol/x/perpetuals/keeper/perpetual.go b/protocol/x/perpetuals/keeper/perpetual.go index 5f3cf9716a1..a434a3bf5f2 100644 --- a/protocol/x/perpetuals/keeper/perpetual.go +++ b/protocol/x/perpetuals/keeper/perpetual.go @@ -173,6 +173,7 @@ func (k Keeper) ModifyPerpetual( perpetual.Params.AtomicResolution, perpetual.Params.LiquidityTier, perpetual.Params.MarketType, + perpetual.Params.DefaultFundingPpm, ), ), ) diff --git a/protocol/x/perpetuals/keeper/perpetual_test.go b/protocol/x/perpetuals/keeper/perpetual_test.go index a0e99f2c8df..306b462f6bc 100644 --- a/protocol/x/perpetuals/keeper/perpetual_test.go +++ b/protocol/x/perpetuals/keeper/perpetual_test.go @@ -42,7 +42,7 @@ func TestModifyPerpetual_Success(t *testing.T) { // Create liquidity tiers and perpetuals, perps := keepertest.CreateLiquidityTiersAndNPerpetuals(t, pc.Ctx, pc.PerpetualsKeeper, pc.PricesKeeper, 100) numMarkets := keepertest.GetNumMarkets(t, pc.Ctx, pc.PricesKeeper) - expectedIndexerEvents := make([]*indexerevents.UpdatePerpetualEventV2, len(perps)) + expectedIndexerEvents := make([]*indexerevents.UpdatePerpetualEventV3, len(perps)) for i, item := range perps { // Modify each field arbitrarily and // verify the fields were modified in state. @@ -61,13 +61,14 @@ func TestModifyPerpetual_Success(t *testing.T) { require.NoError(t, err) // Record the indexer event expected to emit from above `ModifyPerpetual`. - expectedIndexerEvents[i] = &indexerevents.UpdatePerpetualEventV2{ - Id: item.Params.Id, - Ticker: ticker, - MarketId: marketId, - AtomicResolution: item.Params.AtomicResolution, - LiquidityTier: liquidityTier, - MarketType: v1.ConvertToPerpetualMarketType(item.Params.MarketType), + expectedIndexerEvents[i] = &indexerevents.UpdatePerpetualEventV3{ + Id: item.Params.Id, + Ticker: ticker, + MarketId: marketId, + AtomicResolution: item.Params.AtomicResolution, + LiquidityTier: liquidityTier, + MarketType: v1.ConvertToPerpetualMarketType(item.Params.MarketType), + DefaultFunding8HrPpm: defaultFundingPpm, } // Verify updatedp perpetual in store. @@ -114,15 +115,15 @@ func TestModifyPerpetual_Success(t *testing.T) { func getUpdatePerpetualEventsFromIndexerBlock( ctx sdk.Context, perpetualsKeeper *keeper.Keeper, -) []*indexerevents.UpdatePerpetualEventV2 { +) []*indexerevents.UpdatePerpetualEventV3 { block := perpetualsKeeper.GetIndexerEventManager().ProduceBlock(ctx) - var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV2 + var updatePerpetualEvents []*indexerevents.UpdatePerpetualEventV3 for _, event := range block.Events { if event.Subtype != indexerevents.SubtypeUpdatePerpetual { continue } if _, ok := event.OrderingWithinBlock.(*indexer_manager.IndexerTendermintEvent_TransactionIndex); ok { - var updatePerpetualEvent indexerevents.UpdatePerpetualEventV2 + var updatePerpetualEvent indexerevents.UpdatePerpetualEventV3 err := proto.Unmarshal(event.DataBytes, &updatePerpetualEvent) if err != nil { panic(err) diff --git a/protocol/x/perpetuals/types/perpetual.pb.go b/protocol/x/perpetuals/types/perpetual.pb.go index 23257127447..4ccfeccb248 100644 --- a/protocol/x/perpetuals/types/perpetual.pb.go +++ b/protocol/x/perpetuals/types/perpetual.pb.go @@ -122,7 +122,7 @@ type PerpetualParams struct { // then a `PerpetualPosition` with `size = 1e8` is equivalent to // a position size of one full coin. AtomicResolution int32 `protobuf:"zigzag32,4,opt,name=atomic_resolution,json=atomicResolution,proto3" json:"atomic_resolution,omitempty"` - // The default funding payment if there is no price premium. In + // The default (8hr) funding payment if there is no price premium. In // parts-per-million. DefaultFundingPpm int32 `protobuf:"zigzag32,5,opt,name=default_funding_ppm,json=defaultFundingPpm,proto3" json:"default_funding_ppm,omitempty"` // The liquidity_tier that this perpetual is associated with.