diff --git a/src/dlob-subscriber/DLOBSubscriberIO.ts b/src/dlob-subscriber/DLOBSubscriberIO.ts index 92ede4a..f278a9a 100644 --- a/src/dlob-subscriber/DLOBSubscriberIO.ts +++ b/src/dlob-subscriber/DLOBSubscriberIO.ts @@ -136,14 +136,23 @@ export class DLOBSubscriberIO extends DLOBSubscriber { // Test for oracle staleness to know whether to include vamm const dlobSlot = this.slotSource.getSlot(); - const oracleSlot = + const oracleData = marketType === 'perp' ? this.driftClient.getOracleDataForPerpMarket(marketArgs.marketIndex) - .slot - : this.driftClient.getOracleDataForSpotMarket(marketArgs.marketIndex) - .slot; + : this.driftClient.getOracleDataForSpotMarket(marketArgs.marketIndex); + const oracleSlot = oracleData.slot; + const isPerpMarketAndPrelaunchMarket = + marketType === 'perp' && + isVariant( + this.driftClient.getPerpMarketAccount(marketArgs.marketIndex).amm + .oracleSource, + 'prelaunch' + ); let includeVamm = marketArgs.includeVamm; - if (dlobSlot - oracleSlot.toNumber() > STALE_ORACLE_REMOVE_VAMM_THRESHOLD) { + if ( + dlobSlot - oracleSlot.toNumber() > STALE_ORACLE_REMOVE_VAMM_THRESHOLD && + !isPerpMarketAndPrelaunchMarket + ) { logger.info('Oracle is stale, removing vamm orders'); includeVamm = false; } @@ -203,7 +212,8 @@ export class DLOBSubscriberIO extends DLOBSubscriber { if ( Math.abs(slot - parseInt(l2Formatted['oracleData']['slot'])) > this.killSwitchSlotDiffThreshold && - !skipSlotCheck + !skipSlotCheck && + !isPerpMarketAndPrelaunchMarket ) { console.log(`Unhealthy process due to slot diffs for market ${marketName}: dlobProvider slot: ${slot} diff --git a/yarn.lock b/yarn.lock index 88cce00..7b3b678 100644 --- a/yarn.lock +++ b/yarn.lock @@ -453,7 +453,7 @@ kuler "^2.0.0" "@drift-labs/sdk@file:./drift-common/protocol/sdk", "@drift-labs/sdk@file:drift-common/protocol/sdk": - version "2.87.0-beta.5" + version "2.88.0-beta.2" dependencies: "@coral-xyz/anchor" "0.28.0" "@coral-xyz/anchor-30" "npm:@coral-xyz/anchor@0.30.1" @@ -476,7 +476,7 @@ "@drift/common@file:./drift-common/common-ts": version "1.0.0" dependencies: - "@drift-labs/sdk" "file:../../Library/Caches/Yarn/v6/npm-@drift-common-1.0.0-5100cc95-a4ee-4c2f-887c-afd8df503dc6-1722441182380/node_modules/@drift/protocol/sdk" + "@drift-labs/sdk" "file:../../Library/Caches/Yarn/v6/npm-@drift-common-1.0.0-1feb394f-1286-4f02-aa04-2cdc83124014-1722620079611/node_modules/@drift/protocol/sdk" "@jest/globals" "^29.3.1" "@slack/web-api" "^6.4.0" "@solana/spl-token" "^0.3.8"