Skip to content

Commit

Permalink
chore: sum of bigints
Browse files Browse the repository at this point in the history
  • Loading branch information
Picodes committed Jan 17, 2025
1 parent 8a5c44e commit a5d23e9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/components/element/opportunity/OpportunityCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function OpportunityCell({
});
const token = breakdowns?.[0]?.token;
const breakdownAmount = breakdowns.reduce((acc, breakdown) => {
return acc + breakdown.amount;
return BigInt(acc) + BigInt(breakdown.amount);
}, 0n);
return (
<>
Expand All @@ -57,7 +57,7 @@ export default function OpportunityCell({
{Fmt.toNumber(breakdownAmount.toString() ?? "0", token?.decimals).toString()}
</Value>

{` ${token?.symbol}`}
{` ${token?.symbol ?? ""}`}
</Title>
<Text className="text-xl">
<Icon key={token?.icon} src={token?.icon} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/element/opportunity/OpportunityShortCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export default function OpportunityShortCard({ opportunity, displayLinks }: Oppo
});
const token = breakdowns?.[0]?.token;
const breakdownAmount = breakdowns.reduce((acc, breakdown) => {
return acc + breakdown.amount;
return BigInt(acc) + BigInt(breakdown.amount);
}, 0n);
return (
<>
Expand All @@ -31,7 +31,7 @@ export default function OpportunityShortCard({ opportunity, displayLinks }: Oppo
{Fmt.toNumber(breakdownAmount.toString() ?? "0", token?.decimals).toString()}
</Value>

{` ${token?.symbol}`}
{` ${token?.symbol ?? ""}`}
</Title>
<Text className="text-xl">
<Icon key={token?.icon} src={token?.icon} />
Expand Down
4 changes: 2 additions & 2 deletions src/components/element/opportunity/OpportunityTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export default function OpportunityTableRow({
});
const token = breakdowns?.[0]?.token;
const breakdownAmount = breakdowns.reduce((acc, breakdown) => {
return acc + breakdown.amount;
return BigInt(acc) + BigInt(breakdown.amount);
}, 0n);
return (
<>
Expand All @@ -111,7 +111,7 @@ export default function OpportunityTableRow({
{Fmt.toNumber(breakdownAmount.toString() ?? "0", token?.decimals).toString()}
</Value>

{` ${token?.symbol}`}
{` ${token?.symbol ?? ""}`}
</Title>
<Text className="text-xl">
<Icon key={token?.icon} src={token?.icon} />
Expand Down

0 comments on commit a5d23e9

Please sign in to comment.