Skip to content
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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

crispheaney
Copy link
Member

No description provided.

@@ -0,0 +1,27 @@
import { PublicKey } from '@solana/web3.js';
import { OracleSource, OracleSourceNum } from '../types';
Copy link
Member

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);
Copy link
Member

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);
Copy link
Member

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)) {
Copy link
Member

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants