Skip to content

Commit

Permalink
Merge pull request #2165 from JoinColony/fix/2162-properly-check-fund…
Browse files Browse the repository at this point in the history
…s-availability

Properly handle decimals when checking funding availability
  • Loading branch information
rdig authored May 19, 2020
2 parents c625c63 + 8c780d8 commit a978e04
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { useCallback } from 'react';
import { useApolloClient } from '@apollo/react-hooks';
import moveDecimal from 'move-decimal-point';

import { getTokenDecimalsWithFallback } from '~utils/tokens';

import { useDialog } from '~core/Dialog';
import TaskFinalizeDialog from './TaskFinalizeDialog';

Expand Down Expand Up @@ -44,7 +46,10 @@ const useDomainFundsCheck = (
({ amount: availableDomainAmount }) =>
!bnLessThan(
availableDomainAmount,
moveDecimal(amount, domainBalances.decimals || 18),
moveDecimal(
amount,
getTokenDecimalsWithFallback(domainBalances.decimals),
),
),
);
});
Expand Down

0 comments on commit a978e04

Please sign in to comment.