-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
program: refactor oracle map to allow same oracle w diff oracle sources #1346
base: master
Are you sure you want to change the base?
Conversation
@@ -0,0 +1,27 @@ | |||
import { PublicKey } from '@solana/web3.js'; | |||
import { OracleSource, OracleSourceNum } from '../types'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doens't look like OracleSourceNum
exists
} | ||
|
||
public getOraclePriceDataAndSlotForPerpMarket( | ||
marketIndex: number | ||
): DataAndSlot<OraclePriceData> | undefined { | ||
const perpMarketAccount = this.getMarketAccountAndSlot(marketIndex); | ||
const oracle = this.perpOracleMap.get(marketIndex); | ||
const oracleString = this.perpOracleStringMap.get(marketIndex); | ||
if (!perpMarketAccount || !oracle) { | ||
const oracleId = this.perpOracleStringMap.get(marketIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.perpOracleStringMap.set(perpMarketIndex, oracle.toBase58()); |
i think you need to populate this map with oracleId
} | ||
|
||
public getOraclePriceDataAndSlotForSpotMarket( | ||
marketIndex: number | ||
): DataAndSlot<OraclePriceData> | undefined { | ||
const spotMarketAccount = this.getSpotMarketAccountAndSlot(marketIndex); | ||
const oracle = this.spotOracleMap.get(marketIndex); | ||
const oracleString = this.spotOracleStringMap.get(marketIndex); | ||
if (!spotMarketAccount || !oracle) { | ||
const oracleId = this.spotOracleStringMap.get(marketIndex); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this.spotOracleStringMap.set(spotMarketIndex, oracle.toBase58()); |
needa populate this map with oracleId
@@ -31,7 +35,7 @@ export function findDelistedPerpMarketsAndOracles( | |||
continue; | |||
} | |||
|
|||
if (spotMarket.data.oracle.equals(delistedOracle)) { | |||
if (spotMarket.data.oracle.equals(delistedOracle.publicKey)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does it make sense to compare against oracleId instead of just the pubkey?
No description provided.