From 03c88d283313beacc6fa3c79fb4a4e7c6ca3843a Mon Sep 17 00:00:00 2001 From: Keith Date: Tue, 12 Nov 2019 21:40:09 +0800 Subject: [PATCH] fix(neuron-ui): fix the apy calculation --- .../neuron-ui/src/components/CustomRows/DAORecordRow.tsx | 8 +------- packages/neuron-ui/src/utils/calculateAPY.ts | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx b/packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx index 2412f8b2ea..b21f9c2bca 100644 --- a/packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx +++ b/packages/neuron-ui/src/components/CustomRows/DAORecordRow.tsx @@ -134,13 +134,7 @@ const DAORecord = ({
- - {`APY: ~${calculateAPY( - interest >= BigInt(0) ? interest.toString() : '0', - capacity, - `${Date.now() - +timestamp}` - )}%`} - + {`APY: ~${calculateAPY(interest.toString(), capacity, `${Date.now() - +timestamp}`)}%`} {uniformTimeFormatter(+timestamp)} {metaInfo}
diff --git a/packages/neuron-ui/src/utils/calculateAPY.ts b/packages/neuron-ui/src/utils/calculateAPY.ts index 4d08701d29..330e5e1d38 100644 --- a/packages/neuron-ui/src/utils/calculateAPY.ts +++ b/packages/neuron-ui/src/utils/calculateAPY.ts @@ -1,4 +1,4 @@ -const YEAR = 365 * 30 * 24 * 60 * 60 * 1000 +const YEAR = 365 * 24 * 60 * 60 * 1000 export default (interest: string, amount: string, duration: string) => { const BASE = 10000