Skip to content

Commit

Permalink
Merge pull request #2579 from hollaex/testnet
Browse files Browse the repository at this point in the history
Testnet
  • Loading branch information
abeikverdi authored Jan 16, 2024
2 parents 62e30a6 + a33c1f7 commit 72fd843
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 36 deletions.
2 changes: 1 addition & 1 deletion web/src/containers/Stake/DesktopStake.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
97 changes: 62 additions & 35 deletions web/src/containers/Stake/components/CeFiUserStake.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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 (
<div className="d-flex">
{sourceAmount}{' '}
{formattedAmount}{' '}
{(data?.reward_currency || data?.currency).toUpperCase()}
</div>
);
Expand Down Expand Up @@ -543,26 +549,26 @@ const CeFiUserStake = ({ balance, coins, theme }) => {
<h1 className="stake_theme">
{STRINGS['CEFI_STAKE.DURATION_LABEL']}
</h1>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.LOCKUP_DURATION_LABEL']}:{' '}
{selectedPool.duration
? `${selectedPool.duration} days`
: 'Perpetual'}
</div>
<div>-</div>
<div className="stake_theme">-</div>

{selectedPool.slashing && (
<>
<h4 className="stake_theme">Slashing</h4>
<div>
<div className="stake_theme">
{
STRINGS[
'CEFI_STAKE.PENALTY_UPON_INITIAL_STAKE_PRINCIPLE_LABEL'
]
}
: -{selectedPool.slashing_principle_percentage}%{' '}
</div>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.FORFEITURE_OF_EARNINGS_LABEL']}: -
{selectedPool.slashing_earning_percentage}%
</div>
Expand Down Expand Up @@ -675,36 +681,41 @@ const CeFiUserStake = ({ balance, coins, theme }) => {
<h1 className="stake_theme">
{STRINGS['CEFI_STAKE.CHECK_STAKE_DETAILS_BUTTON']}
</h1>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.STAKING_POOL_LABEL']}: {selectedPool.name}
</div>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.ANNUAL_PERCENTAGE_YIELD_LABEL']}:{' '}
{selectedPool.apy}% APY
</div>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.DURATION_LABEL']}: {selectedPool.duration}{' '}
days{' '}
</div>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.PENALTY_UPON_INITIAL_STAKE_PRINCIPLE_LABEL']}
: -{selectedPool.slashing_principle_percentage}%
</div>
<div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.FORFEITURE_OF_EARNINGS_DETAILS_LABEL']}: -
{selectedPool.slashing_earning_percentage}%
</div>

<div style={{ marginTop: 20 }}>
<div className="stake_theme" style={{ marginTop: 20 }}>
{STRINGS['CEFI_STAKE.STAKE_AMOUNT_LABEL']}: {stakerAmount}{' '}
{selectedPool.currency.toUpperCase()}
</div>
<hr />

<div style={{ marginTop: 20, marginBottom: 10 }}>
<div
className="stake_theme"
style={{ marginTop: 20, marginBottom: 10 }}
>
{selectedPool.disclaimer}
</div>
<div>{STRINGS['CEFI_STAKE.SETTLEMENT_NOTICE']}</div>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.SETTLEMENT_NOTICE']}
</div>
</div>
<div
style={{
Expand Down Expand Up @@ -767,6 +778,7 @@ const CeFiUserStake = ({ balance, coins, theme }) => {
}}
>
<div
className="stake_theme"
style={{
display: 'flex',
justifyContent: 'center',
Expand All @@ -775,6 +787,7 @@ const CeFiUserStake = ({ balance, coins, theme }) => {
}}
>
<div
className="stake_theme"
style={{
display: 'flex',
justifyContent: 'center',
Expand All @@ -794,13 +807,21 @@ const CeFiUserStake = ({ balance, coins, theme }) => {
</div>
<div style={{ width: '100%' }}>
<div>
<span style={{ fontWeight: 'bold', marginTop: 20 }}>
<span
className="stake_theme"
style={{ fontWeight: 'bold', marginTop: 20 }}
>
Here we go!{' '}
</span>
</div>
<div>{STRINGS['CEFI_STAKE.STAKE_RULES_NOTICE']}</div>
<div style={{ marginTop: 30 }}> Do you understand?</div>
<div style={{ marginTop: 5 }}>
<div className="stake_theme">
{STRINGS['CEFI_STAKE.STAKE_RULES_NOTICE']}
</div>
<div className="stake_theme" style={{ marginTop: 30 }}>
{' '}
Do you understand?
</div>
<div className="stake_theme" style={{ marginTop: 5 }}>
<Input
className="stake_theme"
style={{
Expand Down Expand Up @@ -1567,23 +1588,29 @@ const CeFiUserStake = ({ balance, coins, theme }) => {
)}
<div style={{ fontSize: 18 }}>
{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 (
<div>
{(
stake.reward_currency || stake.currency
).toUpperCase()}
: {sourceAmount}
: {formattedAmount}
</div>
);
})}
Expand Down

0 comments on commit 72fd843

Please sign in to comment.