Add Math.ceil while calculating relayer fee percent, because if relayer has 0.07% fee, in JS multiplication result of 0.07 * 1e10 is 700000000.0000001 & bump version to 1.3.2

This commit is contained in:
Theo 2023-08-27 05:00:40 -07:00
parent 42b57f8734
commit fb772fa300
2 changed files with 2 additions and 2 deletions

@ -1,6 +1,6 @@
{ {
"name": "@tornado/tornado-oracles", "name": "@tornado/tornado-oracles",
"version": "1.3.1", "version": "1.3.2",
"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",

@ -184,7 +184,7 @@ export abstract class TornadoFeeOracle implements ITornadoFeeOracle {
const gasCosts = BigNumber.from(await this.getGas(tx, type)); const gasCosts = BigNumber.from(await this.getGas(tx, type));
const relayerFee = parseUnits(amount.toString(), decimals) const relayerFee = parseUnits(amount.toString(), decimals)
.mul(`${relayerFeePercent * 1e10}`) .mul(`${Math.floor(relayerFeePercent * 1e10)}`)
.div(`${100 * 1e10}`); .div(`${100 * 1e10}`);
if ((this.chainId === ChainId.MAINNET || this.chainId === ChainId.GOERLI) && currency.toLowerCase() != 'eth') { if ((this.chainId === ChainId.MAINNET || this.chainId === ChainId.GOERLI) && currency.toLowerCase() != 'eth') {