Skip to content

Commit e833337

Browse files
grothemmgrabina
andauthored
fix: slippage input rounding (#2531)
Co-authored-by: Martin Grabina <[email protected]>
1 parent 6fb8a0a commit e833337

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/hooks/paraswap/common.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
TransactionParams,
2323
} from '@paraswap/sdk';
2424
import { GetRateFunctions, RateOptions } from '@paraswap/sdk/dist/methods/swap/rates';
25+
import { BigNumber } from 'bignumber.js';
2526

2627
import { ComputedReserveData } from '../app-data-provider/useAppDataProvider';
2728

@@ -463,7 +464,7 @@ export const maxInputAmountWithSlippage = (
463464
if (inputAmount === '0') return '0';
464465
return valueToBigNumber(inputAmount)
465466
.multipliedBy(1 + Number(slippage) / 100)
466-
.toFixed(decimals);
467+
.toFixed(decimals, BigNumber.ROUND_UP);
467468
};
468469

469470
export const minimumReceivedAfterSlippage = (

0 commit comments

Comments
 (0)