Skip to content

Commit 61d6556

Browse files
fix rounding issue (Uniswap#445)
1 parent ecd7175 commit 61d6556

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/utils/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,7 @@ export async function getTokenAllowance(address, tokenAddress, spenderAddress, l
221221
return getContract(tokenAddress, ERC20_ABI, library).allowance(address, spenderAddress)
222222
}
223223

224+
//
224225
// amount must be a BigNumber, {base,display}Decimals must be Numbers
225226
export function amountFormatter(amount, baseDecimals = 18, displayDecimals = 3, useLessThan = true) {
226227
if (baseDecimals > 18 || displayDecimals > 18 || displayDecimals > baseDecimals) {
@@ -261,10 +262,8 @@ export function amountFormatter(amount, baseDecimals = 18, displayDecimals = 3,
261262
// if there is a decimal portion
262263
else {
263264
const [wholeComponent, decimalComponent] = stringAmount.split('.')
264-
const roundUpAmount = minimumDisplayAmount.div(ethers.constants.Two)
265265
const roundedDecimalComponent = ethers.utils
266266
.bigNumberify(decimalComponent.padEnd(baseDecimals, '0'))
267-
.add(roundUpAmount)
268267
.toString()
269268
.padStart(baseDecimals, '0')
270269
.substring(0, displayDecimals)

0 commit comments

Comments
 (0)