Fix bump function: round to lower when BigNumber stores float value before converting to ethers BigNumber

This commit is contained in:
Theo 2023-08-28 09:01:19 -07:00
parent 342c34b07a
commit c3bfb381b7
2 changed files with 2 additions and 1 deletions

@ -1,6 +1,6 @@
{ {
"name": "@tornado/tornado-oracles", "name": "@tornado/tornado-oracles",
"version": "1.4.0", "version": "1.4.1",
"description": "Gas oracle for Tornado-specific transactions", "description": "Gas oracle for Tornado-specific transactions",
"main": "./lib/index.js", "main": "./lib/index.js",
"types": "./lib/index.d.ts", "types": "./lib/index.d.ts",

@ -25,6 +25,7 @@ export function bump(value: BigNumberish, percent: number): BigNumber {
BigNumberFloat(BigNumber.from(value).toHexString()) BigNumberFloat(BigNumber.from(value).toHexString())
.times(hundredPercents.plus(BigNumberFloat(percent))) .times(hundredPercents.plus(BigNumberFloat(percent)))
.div(hundredPercents) .div(hundredPercents)
.decimalPlaces(0, 1)
.toString(), .toString(),
); );
} }