Skip to content

Commit

Permalink
FIX: pricing discrepancy
Browse files Browse the repository at this point in the history
- fix error with passing APR instead of price value in price fallback loop
  • Loading branch information
Xeonus committed Apr 16, 2024
1 parent 68ff401 commit f13d437
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/pages/VotingIncentives/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default function VotingIncentives() {
const timeStampNow = Math.floor(Date.now() / 1000);
const priceData = HISTORICAL_AURA_PRICE
const { data: auraHistoricalPrice} = useGetHistoricalTokenPrice(AURA_TOKEN_MAINNET, GqlChain.Mainnet)
console.log("auraHistoricalprice: ", auraHistoricalPrice)

const {emissionValuePerVote, emissionsPerDollarSpent} = useGetEmissionPerVote(currentRoundNew);

Expand Down Expand Up @@ -166,20 +167,21 @@ export default function VotingIncentives() {
}
});

//console.log("xAxisData", xAxisData)
//console.log("priceData", priceData)
console.log("xAxisData", xAxisData)
console.log("priceData", priceData)
let historicalPrice = xAxisData.map((el) => {
const price = priceData.find(price => el === price.time);
const fallbackPrice = auraHistoricalPrice ? auraHistoricalPrice.find(price => el === price.time) : 0
if (price) {
return price.value;
} else if (auraHistoricalPrice && fallbackPrice) {
return dollarPerVlAssetData[xAxisData.indexOf(el)] * 2 * 12 / fallbackPrice.value;
return fallbackPrice.value;
}
else {
return 0; // Fallback value
}
});
console.log("historical aura price:", historicalPrice)

return (<>
{(!roundsData?.rounds
Expand Down

0 comments on commit f13d437

Please sign in to comment.