Skip to content

Commit

Permalink
feat: display average APYs on Market page
Browse files Browse the repository at this point in the history
  • Loading branch information
therealemjy committed Nov 29, 2024
1 parent d28cda2 commit a4e3ade
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/thin-singers-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@venusprotocol/evm": minor
---

display average APYs on Market page
1 change: 1 addition & 0 deletions apps/evm/src/libs/translations/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@
},
"stats": {
"apy": "APY",
"averageApy": "Average APY",
"distributionApy": "Distribution APY",
"liquidationPenalty": "Liquidation Penalty",
"liquidationThreshold": "Liquidation Threshold"
Expand Down
10 changes: 10 additions & 0 deletions apps/evm/src/pages/Market/Page/MarketHistory/Card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,18 @@ export const Card: React.FC<CardProps> = ({
return [];
}

const averageApy =
data.length > 0
? data.reduce((acc, item) => acc + item.apyPercentage, 0) / data.length
: undefined;

const distributionApys = getCombinedDistributionApys({ asset });

const tmpStats: MarketCardProps['stats'] = [
{
label: t('market.stats.averageApy'),
value: formatPercentageToReadableValue(averageApy),
},
{
label: t('market.stats.apy'),
value: formatPercentageToReadableValue(
Expand Down Expand Up @@ -116,6 +125,7 @@ export const Card: React.FC<CardProps> = ({
return tmpStats;
}, [
asset,
data,
t,
type,
liquidationIncentivePercentage,
Expand Down

0 comments on commit a4e3ade

Please sign in to comment.