-
Notifications
You must be signed in to change notification settings - Fork 134
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
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
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.
didnt check it in 🤦
} | ||
|
||
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
sdk/src/accounts/utils.ts
Outdated
@@ -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?
…es (#1346) * program: refactor oracle map to allow same oracle w diff oracle sources * rm some code * rename get_oracle_id to oracle_id * start fixing tests * fix remainder of tests * add another test * more red diffs * fix a compiler warning * start adding ts changes * add ws drift client account sub * add grpc implementation * prettify:fix * check in missing OracleSourceNum * update some missing use of getOracleId * tweak findDelistedPerpMarketsAndOracles logic * add bankrun test * prettify:fix * fix findDelistedPerpMarketsAndOracles * update test * fix linters * CHANGELOG
No description provided.