Skip to content

Commit

Permalink
fix debt existence check
Browse files Browse the repository at this point in the history
  • Loading branch information
asoltys committed Jun 18, 2019
1 parent e31f66b commit b1d7bb9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/store/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import React, {

import actions from "./actions";
import { sha3_512 } from "js-sha3";
import { BigNumber } from "bignumber.js";

const state = {
address: null,
Expand All @@ -18,6 +19,7 @@ const state = {
blockchain: null,
closeThreshold: null,
daoAddress: null,
debt: new BigNumber("0"),
debts: [],
device: null,
exits: [],
Expand Down
4 changes: 2 additions & 2 deletions src/utils/LowBalance.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ const LowBalance = () => {
const [t] = useTranslation();
const [{ balance, debt, closeThreshold, lowBalance }] = useStore();

if (!lowBalance || !debt || !debt.negative) return null;
if (!lowBalance || !debt) return null;

if (
debt.negative().isLessThan(BigNumber(closeThreshold)) ||
debt.negated().isLessThan(BigNumber(closeThreshold)) ||
parseInt(balance) === 0
)
return <div className="low-balance">{t("accountThrottled")}</div>;
Expand Down

0 comments on commit b1d7bb9

Please sign in to comment.