Skip to content

Commit

Permalink
chore: add url to oracle img
Browse files Browse the repository at this point in the history
  • Loading branch information
borcherd committed Dec 13, 2024
1 parent b66e53b commit 6090499
Showing 1 changed file with 27 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { MarginRequirementType, SimulationResult } from "@mrgnlabs/marginfi-clie
import { AccountSummary } from "@mrgnlabs/marginfi-v2-ui-state";
import { percentFormatter, tokenPriceFormatter, usdFormatter } from "@mrgnlabs/mrgn-common";
import { LoopActionTxns } from "@mrgnlabs/mrgn-utils";
import { IconArrowRight } from "@tabler/icons-react";
import Link from "next/link";
import { PreviewStat } from "~/components/action-box-v2/utils";
import { IconPyth } from "~/components/ui/icons";
import { IconSwitchboard } from "~/components/ui/icons";
Expand Down Expand Up @@ -63,24 +63,44 @@ export function generateTradeStats(props: generateTradeStatsProps) {
}

// oracle stat
let oracle = "";
let oracle = {
name: "",
link: "",
};

switch (props.extendedPool.tokenBank.info.rawBank.config.oracleSetup) {
case "PythLegacy":
oracle = "Pyth";
oracle = {
name: "Pyth",
link: "https://pyth.network/",
};
break;
case "PythPushOracle":
oracle = "Pyth";
oracle = {
name: "Pyth",
link: "https://pyth.network/",
};
break;
case "SwitchboardV2":
oracle = "Switchboard";
oracle = {
name: "Switchboard",
link: `https://ondemand.switchboard.xyz/solana/mainnet/feed/${props.extendedPool.tokenBank.info.rawBank.config.oracleKeys[0].toBase58()}`,
};
break;
case "SwitchboardPull":
oracle = {
name: "Switchboard",
link: `https://ondemand.switchboard.xyz/solana/mainnet/feed/${props.extendedPool.tokenBank.info.rawBank.config.oracleKeys[0].toBase58()}`,
};
break;
}
stats.push({
label: "Oracle",
value: () => (
<>
{oracle}
{oracle === "Pyth" ? <IconPyth size={14} /> : <IconSwitchboard size={14} />}
<Link href={oracle.link} target="_blank">
{oracle.name === "Pyth" ? <IconPyth size={14} /> : <IconSwitchboard size={14} />}
</Link>
</>
),
});
Expand Down

0 comments on commit 6090499

Please sign in to comment.