diff --git a/web/src/containers/Stake/DesktopStake.js b/web/src/containers/Stake/DesktopStake.js index 2ed7b761ef..2a2d3af516 100644 --- a/web/src/containers/Stake/DesktopStake.js +++ b/web/src/containers/Stake/DesktopStake.js @@ -4,7 +4,7 @@ import { bindActionCreators } from 'redux'; import mathjs from 'mathjs'; import classnames from 'classnames'; import { ClockCircleOutlined } from '@ant-design/icons'; -import { Button as AntBtn, Switch } from 'antd'; +import { Button as AntBtn } from 'antd'; import { connectWallet, loadBlockchainData, diff --git a/web/src/containers/Stake/components/CeFiUserStake.js b/web/src/containers/Stake/components/CeFiUserStake.js index 63f702be20..540f24b412 100644 --- a/web/src/containers/Stake/components/CeFiUserStake.js +++ b/web/src/containers/Stake/components/CeFiUserStake.js @@ -23,6 +23,7 @@ import moment from 'moment'; import BigNumber from 'bignumber.js'; import { Link } from 'react-router'; import STRINGS from 'config/localizedStrings'; +import { formatToCurrency } from 'utils/currency'; import '../CeFiStake.scss'; import { NotLoggedIn } from 'components'; @@ -151,18 +152,23 @@ const CeFiUserStake = ({ balance, coins, theme }) => { dataIndex: 'earnt', key: 'earnt', render: (_user_id, data) => { - const incrementUnit = - coins[data.reward_currency || data.currency].increment_unit; - const decimalPoint = new BigNumber(incrementUnit).dp(); - const sourceAmount = - data?.reward && - new BigNumber(data?.reward - data?.slashed) - .decimalPlaces(decimalPoint) - .toNumber(); + // const incrementUnit = + // coins[data.reward_currency || data.currency].increment_unit; + + const min = coins[data.reward_currency || data.currency].min; + // const decimalPoint = new BigNumber(incrementUnit).dp(); + // const sourceAmount = + // data?.reward && + // new BigNumber(data?.reward - data?.slashed) + // .decimalPlaces(decimalPoint) + // .toNumber(); + + const formattedAmount = + data?.reward && formatToCurrency(data?.reward - data?.slashed, min); return (
- {sourceAmount}{' '} + {formattedAmount}{' '} {(data?.reward_currency || data?.currency).toUpperCase()}
); @@ -543,18 +549,18 @@ const CeFiUserStake = ({ balance, coins, theme }) => {

{STRINGS['CEFI_STAKE.DURATION_LABEL']}

-
+
{STRINGS['CEFI_STAKE.LOCKUP_DURATION_LABEL']}:{' '} {selectedPool.duration ? `${selectedPool.duration} days` : 'Perpetual'}
-
-
+
-
{selectedPool.slashing && ( <>

Slashing

-
+
{ STRINGS[ 'CEFI_STAKE.PENALTY_UPON_INITIAL_STAKE_PRINCIPLE_LABEL' @@ -562,7 +568,7 @@ const CeFiUserStake = ({ balance, coins, theme }) => { } : -{selectedPool.slashing_principle_percentage}%{' '}
-
+
{STRINGS['CEFI_STAKE.FORFEITURE_OF_EARNINGS_LABEL']}: - {selectedPool.slashing_earning_percentage}%
@@ -675,36 +681,41 @@ const CeFiUserStake = ({ balance, coins, theme }) => {

{STRINGS['CEFI_STAKE.CHECK_STAKE_DETAILS_BUTTON']}

-
+
{STRINGS['CEFI_STAKE.STAKING_POOL_LABEL']}: {selectedPool.name}
-
+
{STRINGS['CEFI_STAKE.ANNUAL_PERCENTAGE_YIELD_LABEL']}:{' '} {selectedPool.apy}% APY
-
+
{STRINGS['CEFI_STAKE.DURATION_LABEL']}: {selectedPool.duration}{' '} days{' '}
-
+
{STRINGS['CEFI_STAKE.PENALTY_UPON_INITIAL_STAKE_PRINCIPLE_LABEL']} : -{selectedPool.slashing_principle_percentage}%
-
+
{STRINGS['CEFI_STAKE.FORFEITURE_OF_EARNINGS_DETAILS_LABEL']}: - {selectedPool.slashing_earning_percentage}%
-
+
{STRINGS['CEFI_STAKE.STAKE_AMOUNT_LABEL']}: {stakerAmount}{' '} {selectedPool.currency.toUpperCase()}

-
+
{selectedPool.disclaimer}
-
{STRINGS['CEFI_STAKE.SETTLEMENT_NOTICE']}
+
+ {STRINGS['CEFI_STAKE.SETTLEMENT_NOTICE']} +
{ }} >
{ }} >
{
- + Here we go!{' '}
-
{STRINGS['CEFI_STAKE.STAKE_RULES_NOTICE']}
-
Do you understand?
-
+
+ {STRINGS['CEFI_STAKE.STAKE_RULES_NOTICE']} +
+
+ {' '} + Do you understand? +
+
{ )}
{accumulateReward(userStakeData).map((stake) => { - const incrementUnit = - coins[stake.currency].increment_unit; - const decimalPoint = new BigNumber( - incrementUnit - ).dp(); - const sourceAmount = + const min = coins[stake.currency].min; + + // const incrementUnit = + // coins[stake.currency].increment_unit; + // const decimalPoint = new BigNumber( + // incrementUnit + // ).dp(); + // const sourceAmount = + // stake?.reward && + // new BigNumber(stake?.reward) + // .decimalPlaces(decimalPoint) + // .toNumber(); + + const formattedAmount = stake?.reward && - new BigNumber(stake?.reward) - .decimalPlaces(decimalPoint) - .toNumber(); + formatToCurrency(stake?.reward, min); return (
{( stake.reward_currency || stake.currency ).toUpperCase()} - : {sourceAmount} + : {formattedAmount}
); })}