Skip to content

Commit

Permalink
fix: use balances subgraph for tpi on homepage
Browse files Browse the repository at this point in the history
  • Loading branch information
pocin committed Jun 17, 2024
1 parent 2990e77 commit 164e533
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions apps/dapp/src/components/Pages/Core/NewUI/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ const Home = ({ tlc }: { tlc?: boolean }) => {
treasuryReservesVaults {
principalUSD
benchmarkedEquityUSD
treasuryPriceIndex
}
}`
);
Expand All @@ -123,22 +124,13 @@ const Home = ({ tlc }: { tlc?: boolean }) => {
}`
);

const { data: tpiData } = await fetchGenericSubgraph<any>(
env.subgraph.templeV2,
`{
tpiOracles {
currentTpi
}
}`
);
const treasuryMetrics = treasuryData.treasuryReservesVaults[0];
setMetrics({
price: parseFloat(ramosData.metrics[0].spotPrice),
tpi: parseFloat(tpiData.tpiOracles[0].currentTpi),
tpi: parseFloat(treasuryMetrics.treasuryPriceIndex),
treasury:
parseFloat(treasuryData.treasuryReservesVaults[0].principalUSD) +
parseFloat(
treasuryData.treasuryReservesVaults[0].benchmarkedEquityUSD
),
parseFloat(treasuryMetrics.principalUSD) +
parseFloat(treasuryMetrics.benchmarkedEquityUSD),
});
};
fetchMetrics();
Expand Down

0 comments on commit 164e533

Please sign in to comment.