Skip to content

Commit

Permalink
fix stimmy rounding (#1598)
Browse files Browse the repository at this point in the history
  • Loading branch information
BrodyHughes authored Jun 25, 2024
1 parent 5bd563a commit 1688f26
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/entries/popup/pages/home/Points/PointsDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
convertAmountAndPriceToNativeDisplay,
convertRawAmountToBalance,
convertRawAmountToDecimalFormat,
handleSignificantDecimalsWithThreshold,
} from '~/core/utils/numbers';
import {
Box,
Expand Down Expand Up @@ -702,6 +703,12 @@ function ClaimYourPointsCta({
currentTheme === 'dark'
? 'linear-gradient(to right, #242529, #242529)'
: 'linear-gradient(to right, #fff, #fff)';

const reward = handleSignificantDecimalsWithThreshold(
convertRawAmountToDecimalFormat(claimableReward, 18),
6,
'0.000001',
);
return (
<Box
as={motion.div}
Expand All @@ -722,7 +729,6 @@ function ClaimYourPointsCta({
whileFocus={{ scale: 1.02 }}
whileHover={{ scale: 1.02 }}
onClick={() => {
// TODO: Also track amount in USD
analytics.track(event.pointsRewardsClaimButtonClicked, {
claimAmount: Number(
convertRawAmountToDecimalFormat(claimableReward, 18),
Expand All @@ -733,7 +739,7 @@ function ClaimYourPointsCta({
>
<RainbowText size="20pt" weight="heavy">
{i18n.t('points.rewards.claim_reward', {
reward: `${convertRawAmountToDecimalFormat(claimableReward, 18)} ETH`,
reward: `${reward} ETH `,
})}
</RainbowText>
<Box
Expand Down

0 comments on commit 1688f26

Please sign in to comment.