diff --git a/.changeset/thin-singers-brake.md b/.changeset/thin-singers-brake.md new file mode 100644 index 0000000000..3c17f9908d --- /dev/null +++ b/.changeset/thin-singers-brake.md @@ -0,0 +1,5 @@ +--- +"@venusprotocol/evm": minor +--- + +display average APYs on Market page diff --git a/apps/evm/src/libs/translations/translations/en.json b/apps/evm/src/libs/translations/translations/en.json index c16fb79b83..65a2b28c77 100644 --- a/apps/evm/src/libs/translations/translations/en.json +++ b/apps/evm/src/libs/translations/translations/en.json @@ -409,7 +409,8 @@ "thirtyDays": "30D" }, "stats": { - "apy": "APY", + "apy": "Current APY", + "averageApy": "Average APY", "distributionApy": "Distribution APY", "liquidationPenalty": "Liquidation Penalty", "liquidationThreshold": "Liquidation Threshold" diff --git a/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/index.spec.tsx.snap b/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/index.spec.tsx.snap index 447c074479..5e0e23d8fc 100644 --- a/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/index.spec.tsx.snap @@ -2,8 +2,8 @@ exports[`CorePoolMarket > fetches market details and displays them correctly 1`] = `"Interest Rate ModelUtilization rateBorrow APYSupply APY"`; -exports[`CorePoolMarket > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAPY0.05%Distribution APY0.11%"`; +exports[`CorePoolMarket > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAverage APY-Current APY0.05%Distribution APY0.11%"`; -exports[`CorePoolMarket > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAPY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty10%"`; +exports[`CorePoolMarket > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAverage APY-Current APY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty10%"`; exports[`CorePoolMarket > fetches market details and displays them correctly 4`] = `"Market infoPrice$1.278673Market liquidity$80.36MDaily supplying interests$3.98Daily borrowing interests-$44.81Daily XVS distributed19.99MReserves1K XVSReserve factor25%Collateral factor50%vXVS minted> 100TExchange rate1 XVS=49.589181 vXVS"`; diff --git a/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexApyCharts.spec.tsx.snap b/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexApyCharts.spec.tsx.snap index 23b40f312d..891c301454 100644 --- a/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexApyCharts.spec.tsx.snap +++ b/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexApyCharts.spec.tsx.snap @@ -1,8 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`CorePoolMarket - Feature flag enabled: apyCharts > fetches market details and displays them correctly 1`] = `"Supply info30D6M1Y0%Total supplied> $100T / > $100T> 100T / > 100T XVSAPY0.05%Distribution APY0.11%Supply APY"`; +exports[`CorePoolMarket - Feature flag enabled: apyCharts > fetches market details and displays them correctly 1`] = `"Supply info30D6M1Y0%Total supplied> $100T / > $100T> 100T / > 100T XVSAverage APY-Current APY0.05%Distribution APY0.11%Supply APY"`; -exports[`CorePoolMarket - Feature flag enabled: apyCharts > fetches market details and displays them correctly 2`] = `"Borrow info30D6M1Y0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAPY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty10%Borrow APY"`; +exports[`CorePoolMarket - Feature flag enabled: apyCharts > fetches market details and displays them correctly 2`] = `"Borrow info30D6M1Y0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAverage APY-Current APY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty10%Borrow APY"`; exports[`CorePoolMarket - Feature flag enabled: apyCharts > fetches market details and displays them correctly 3`] = `"Interest Rate ModelUtilization rateBorrow APYSupply APY"`; diff --git a/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap b/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap index 4886c7fb52..26506c3052 100644 --- a/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap +++ b/apps/evm/src/pages/Market/CorePoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap @@ -2,8 +2,8 @@ exports[`CorePoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 1`] = `"Interest Rate ModelUtilization rateBorrow APYSupply APY"`; -exports[`CorePoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAPY0.05%Distribution APY0.11%"`; +exports[`CorePoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAverage APY-Current APY0.05%Distribution APY0.11%"`; -exports[`CorePoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAPY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-"`; +exports[`CorePoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAverage APY-Current APY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-"`; exports[`CorePoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 4`] = `"Market infoPrice$1.278673Market liquidity$80.36M# of suppliers100# of borrowers10Daily supplying interests$3.98Daily borrowing interests-$44.81Daily XVS distributed19.99MReserves1K XVSReserve factor25%Collateral factor50%vXVS minted> 100TExchange rate1 XVS=49.589181 vXVS"`; diff --git a/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/index.spec.tsx.snap b/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/index.spec.tsx.snap index a4512bf9b3..ae73b96cd7 100644 --- a/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/index.spec.tsx.snap +++ b/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/index.spec.tsx.snap @@ -2,8 +2,8 @@ exports[`IsolatedPoolMarket > fetches market details and displays them correctly 1`] = `"Interest Rate ModelUtilization rateBorrow APYSupply APY"`; -exports[`IsolatedPoolMarket > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAPY0.05%Distribution APY0.11%"`; +exports[`IsolatedPoolMarket > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAverage APY-Current APY0.05%Distribution APY0.11%"`; -exports[`IsolatedPoolMarket > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAPY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-"`; +exports[`IsolatedPoolMarket > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAverage APY-Current APY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-"`; exports[`IsolatedPoolMarket > fetches market details and displays them correctly 4`] = `"Market infoPrice$1.278673Market liquidity$80.36MDaily supplying interests$3.98Daily borrowing interests-$44.81Daily XVS distributed19.99MReserves1K XVSReserve factor25%Collateral factor50%vXVS minted> 100TExchange rate1 XVS=49.589181 vXVS"`; diff --git a/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketHistory.spec.tsx.snap b/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketHistory.spec.tsx.snap index dd41c0fc03..83ee49095b 100644 --- a/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketHistory.spec.tsx.snap +++ b/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketHistory.spec.tsx.snap @@ -1,8 +1,8 @@ // Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html -exports[`IsolatedPoolMarket - Feature flag enabled: marketHistory > fetches market details and displays them correctly 1`] = `"Supply info30D6M1Y0%Total supplied> $100T / > $100T> 100T / > 100T XVSAPY0.05%Distribution APY0.11%Supply APY"`; +exports[`IsolatedPoolMarket - Feature flag enabled: marketHistory > fetches market details and displays them correctly 1`] = `"Supply info30D6M1Y0%Total supplied> $100T / > $100T> 100T / > 100T XVSAverage APY-Current APY0.05%Distribution APY0.11%Supply APY"`; -exports[`IsolatedPoolMarket - Feature flag enabled: marketHistory > fetches market details and displays them correctly 2`] = `"Borrow info30D6M1Y0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAPY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-Borrow APY"`; +exports[`IsolatedPoolMarket - Feature flag enabled: marketHistory > fetches market details and displays them correctly 2`] = `"Borrow info30D6M1Y0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAverage APY-Current APY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-Borrow APY"`; exports[`IsolatedPoolMarket - Feature flag enabled: marketHistory > fetches market details and displays them correctly 3`] = `"Interest Rate ModelUtilization rateBorrow APYSupply APY"`; diff --git a/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap b/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap index dfffb93a51..32ac970d59 100644 --- a/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap +++ b/apps/evm/src/pages/Market/IsolatedPoolMarket/__tests__/__snapshots__/indexMarketParticipantCounts.spec.tsx.snap @@ -2,8 +2,8 @@ exports[`IsolatedPoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 1`] = `"Interest Rate ModelUtilization rateBorrow APYSupply APY"`; -exports[`IsolatedPoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAPY0.05%Distribution APY0.11%"`; +exports[`IsolatedPoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 2`] = `"Supply info0%Total supplied> $100T / > $100T> 100T / > 100T XVSAverage APY-Current APY0.05%Distribution APY0.11%"`; -exports[`IsolatedPoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAPY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-"`; +exports[`IsolatedPoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 3`] = `"Borrow info0%Total borrowed$2.36M / > $100T1.85M / > 100T XVSAverage APY-Current APY-2.3%Distribution APY4.17%Liquidation Threshold50%Liquidation Penalty-"`; exports[`IsolatedPoolMarket - Feature flag enabled: marketParticipantCounts > fetches market details and displays them correctly 4`] = `"Market infoPrice$1.278673Market liquidity$80.36M# of suppliers100# of borrowers10Daily supplying interests$3.98Daily borrowing interests-$44.81Daily XVS distributed19.99MReserves1K XVSReserve factor25%Collateral factor50%vXVS minted> 100TExchange rate1 XVS=49.589181 vXVS"`; diff --git a/apps/evm/src/pages/Market/Page/MarketHistory/Card/index.tsx b/apps/evm/src/pages/Market/Page/MarketHistory/Card/index.tsx index 59c42f95b1..3589f48f96 100644 --- a/apps/evm/src/pages/Market/Page/MarketHistory/Card/index.tsx +++ b/apps/evm/src/pages/Market/Page/MarketHistory/Card/index.tsx @@ -81,9 +81,18 @@ export const Card: React.FC = ({ 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( @@ -116,6 +125,7 @@ export const Card: React.FC = ({ return tmpStats; }, [ asset, + data, t, type, liquidationIncentivePercentage, diff --git a/apps/evm/src/pages/Market/Page/index.tsx b/apps/evm/src/pages/Market/Page/index.tsx index 4386db4bdd..5579485d4c 100644 --- a/apps/evm/src/pages/Market/Page/index.tsx +++ b/apps/evm/src/pages/Market/Page/index.tsx @@ -1,4 +1,4 @@ -import { Card, Page as PaceComp } from 'components'; +import { Card, Page as PageComp } from 'components'; import type { Asset, Pool } from 'types'; import AssetWarning from './AssetWarning'; @@ -13,7 +13,7 @@ export interface PageProps { } export const Page: React.FC = ({ asset, pool }) => ( - +
= ({ asset, pool }) => (
-
+ );