Skip to content

Commit

Permalink
fix: division
Browse files Browse the repository at this point in the history
  • Loading branch information
ayushtom committed Jan 25, 2024
1 parent 30d11a1 commit d26e41d
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
7 changes: 6 additions & 1 deletion app/quest-boost/[boostId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ export default function Page({ params }: BoostQuestPageProps) {
? parseInt(
String(
boost?.amount /
TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
Math.pow(
10,
TOKEN_DECIMAL_MAP[
getTokenName(boost?.token ?? "")
]
)
)
)
: 0}{" "}
Expand Down
3 changes: 2 additions & 1 deletion app/quest-boost/claim/[boostId]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ export default function Page({ params }: BoostQuestPageProps) {
setDisplayAmount(
parseInt(
String(
boost?.amount / TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
boost?.amount /
Math.pow(10, TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")])
)
)
);
Expand Down
3 changes: 2 additions & 1 deletion components/UI/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ const Navbar: FunctionComponent = () => {
title: "Congratulations! 🎉",
subtext: `You have just won ${parseInt(
String(
boost?.amount / TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
boost?.amount /
Math.pow(10, TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")])
)
)} USDC thanks to the "${boost.name}” boost`,
link: "/quest-boost/" + boost.id,
Expand Down
5 changes: 4 additions & 1 deletion components/quest-boost/boostCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ const BoostCard: FunctionComponent<BoostCardProps> = ({
{parseInt(
String(
boost?.amount /
TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
Math.pow(
10,
TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
)
)
)}
</p>
Expand Down
5 changes: 4 additions & 1 deletion components/quests/quest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ const Quest: FunctionComponent<QuestProps> = ({
{parseInt(
String(
boost?.amount /
TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
Math.pow(
10,
TOKEN_DECIMAL_MAP[getTokenName(boost?.token ?? "")]
)
)
)}
</p>
Expand Down

0 comments on commit d26e41d

Please sign in to comment.