Skip to content

Commit

Permalink
Merge pull request #307 from reflexer-labs/develop
Browse files Browse the repository at this point in the history
fix repay amount
  • Loading branch information
mstfash authored Mar 17, 2022
2 parents 135406e + 70dd51d commit bc106c6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/hooks/useSafe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export function useTotalDebt(rightInput: string, type: SafeTypes) {
return rightInput
}, [singleSafe, rightInput, type, accumulatedRate])

return totalDebt || '0'
return totalDebt && Number(totalDebt) > 0.00001 ? totalDebt : '0'
}

export function useCollateralRatio(totalCollateral: string, totalDebt: string) {
Expand Down
7 changes: 1 addition & 6 deletions src/utils/helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,7 @@ export const returnTotalValue = (
: BigNumber.from('0')

const totalBN = isRepay ? firstBN.sub(secondBN) : firstBN.add(secondBN)
if (Number(totalBN) < 0.00001) {
if (!beautify) {
return BigNumber.from('0')
}
return '0'
}

if (!beautify) return totalBN
return formatNumber(gebUtils.wadToFixed(totalBN).toString()).toString()
}
Expand Down

0 comments on commit bc106c6

Please sign in to comment.