Skip to content

Commit

Permalink
fix: toBigNumber
Browse files Browse the repository at this point in the history
  • Loading branch information
DillonLin authored May 25, 2023
1 parent 2f61aa0 commit 3d92791
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions app/src/utils/toBigNumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@ import { BigNumber } from '@ethersproject/bignumber'
import { parseUnits } from '@ethersproject/units'

export default function toBigNumber(number: number, decimals: number = 18): BigNumber {
const numberStr = number.toString().includes('e') ? number.toFixed(decimals).toString() : number.toString()
return parseUnits(numberStr, decimals)
return parseUnits(number.toFixed(decimals).toString(), decimals)
}

0 comments on commit 3d92791

Please sign in to comment.