Skip to content

Commit

Permalink
Fix Bignumber error
Browse files Browse the repository at this point in the history
Signed-off-by: Manank Patni <manank321@gmail.com>
  • Loading branch information
Man-Jain committed Jun 17, 2023
1 parent 13f00d5 commit eaf0a2d
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/modules/explorer/pages/ProposalDetails/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,12 @@ export const ProposalDetails: React.FC = () => {
// !dao?.data.ledger.find(l => l.holder.address.toLowerCase() === account.toLowerCase())?.staked.isZero()

const parseReadableConfigValue = (configKey: any, value: BigNumber) => {
if (dao) {
if (dao && value) {
switch (configKey) {
case "frozen_extra_value":
return parseUnits(value, dao.data.token.decimals).toString()
case "slash_scale_value":
return 100 - value.toNumber()

default:
return value.toString()
}
Expand Down Expand Up @@ -415,7 +414,7 @@ export const ProposalDetails: React.FC = () => {
</Typography>{" "}
to{" "}
<Typography variant="body1" color="secondary" display={"inline"}>
{parseReadableConfigValue(key as keyof Proposal["metadata"]["config"], value)}
{parseReadableConfigValue(key as keyof Proposal["metadata"]["config"], value) ?? 0}
</Typography>
</DetailsText>
</Grid>
Expand Down

0 comments on commit eaf0a2d

Please sign in to comment.