Skip to content

Commit

Permalink
common: revert jlp pool markets lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
evanpipta committed Dec 4, 2024
1 parent 87957c8 commit 671748b
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions common-ts/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,15 @@ import {
initialize,
PerpMarketConfig,
} from '@drift-labs/sdk';
import { JLP_POOL_ID, MAIN_POOL_ID } from './constants';

export const Config: {
initialized: boolean;
spotMarketsLookup: SpotMarketConfig[];
jlpSpotMarketsLookup: SpotMarketConfig[];
perpMarketsLookup: PerpMarketConfig[];
sdkConfig: ReturnType<typeof initialize>;
} = {
initialized: false,
spotMarketsLookup: [],
jlpSpotMarketsLookup: [],
perpMarketsLookup: [],
sdkConfig: undefined,
};
Expand All @@ -31,28 +28,18 @@ export const Initialize = (env: DriftEnv) => {
...SDKConfig.PERP_MARKETS.map((market) => market.marketIndex)
);

const jlpSpotMarkets = new Array(maxSpotMarketIndex);
const spotMarkets = new Array(maxSpotMarketIndex);
const markets = new Array(maxPerpMarketIndex);

SDKConfig.SPOT_MARKETS.filter(
(market) => market.poolId === MAIN_POOL_ID
).forEach((spotMarket) => {
SDKConfig.SPOT_MARKETS.forEach((spotMarket) => {
spotMarkets[spotMarket.marketIndex] = spotMarket;
});

SDKConfig.SPOT_MARKETS.filter(
(market) => market.poolId === JLP_POOL_ID
).forEach((spotMarket) => {
jlpSpotMarkets[spotMarket.marketIndex] = spotMarket;
});

SDKConfig.PERP_MARKETS.forEach((perpMarket) => {
markets[perpMarket.marketIndex] = perpMarket;
});

Config.spotMarketsLookup = spotMarkets;
Config.jlpSpotMarketsLookup = jlpSpotMarkets;
Config.perpMarketsLookup = markets;

Config.initialized = true;
Expand Down

0 comments on commit 671748b

Please sign in to comment.