fixed USDC APY

This commit is contained in:
Finn 2024-02-28 11:04:28 +00:00
parent ac52e6f03c
commit aab1d431fa
2 changed files with 8 additions and 7 deletions

View File

@ -121,7 +121,7 @@ const PositionItem = ({
}
}, [group, acct])
const [liqRatio, liqPriceChangePercentage] = useMemo(() => {
const [liqRatio] = useMemo(() => {
if (!borrowBalance || !borrowBank) return ['0.00', '']
const liqRatio = getLiquidationRatio(
borrowBalance,
@ -136,13 +136,13 @@ const PositionItem = ({
return [liqRatio, liqPriceChangePercentage.toFixed(2)]
}, [bank, borrowBalance, borrowBank, stakeBalance])
console.log('liq price change percentage', liqPriceChangePercentage)
const { financialMetrics, stakeBankDepositRate } = useBankRates(
bank.name,
leverage,
)
const uiRate = bank.name == 'USDC' ? Number(stakeBankDepositRate) * 100 : financialMetrics.APY
const APY_Daily_Compound = Math.pow(1 + Number(stakeBankDepositRate) / 365, 365) - 1;
const uiRate = bank.name == 'USDC' ? APY_Daily_Compound * 100 : financialMetrics.APY
return (
<div className="rounded-2xl border-2 border-th-fgd-1 bg-th-bkg-1 p-6">

View File

@ -24,9 +24,10 @@ const TokenButton = ({
1,
)
const APY_Daily_Compound = Math.pow(1 + Number(stakeBankDepositRate) / 365, 365) - 1;
const UiRate =
tokenName === 'USDC'
? Number(stakeBankDepositRate) * 100
? APY_Daily_Compound * 100
: Math.max(estimatedNetAPYFor1xLev.APY, financialMetrics.APY)
return (
@ -74,8 +75,8 @@ const TokenButton = ({
// </SheenLoader>
// ) :
tokenName === 'USDC'
? `${UiRate.toFixed(2)}%`
: `Up to ${UiRate.toFixed(2)}%`
? `${UiRate.toFixed(2)}% APY`
: `Up to ${UiRate.toFixed(2)}% APY`
}
</span>
</div>