fix: fee convert to BN

This commit is contained in:
nikdementev 2021-05-23 13:29:07 +03:00 committed by Nikita Dement'ev
parent 33b6561ffe
commit 0a1b9ab06a

@ -114,7 +114,7 @@ async function checkTornadoFee({ args, contract }) {
const ethPrice = await redis.hget('prices', currency) const ethPrice = await redis.hget('prices', currency)
const expense = toBN(toWei(fast.toString(), 'gwei')).mul(toBN(gasLimits[jobType.TORNADO_WITHDRAW])) const expense = toBN(toWei(fast.toString(), 'gwei')).mul(toBN(gasLimits[jobType.TORNADO_WITHDRAW]))
const feePercent = toBN(fromDecimals(amount, decimals)) const feePercent = toBN(fromDecimals(amount, decimals))
.mul(toBN(tornadoServiceFee * 1e10)) .mul(toBN(parseInt(tornadoServiceFee * 1e10)))
.div(toBN(1e10 * 100)) .div(toBN(1e10 * 100))
let desiredFee let desiredFee
switch (currency) { switch (currency) {
@ -159,7 +159,7 @@ async function checkMiningFee({ args }) {
? toBN(0) ? toBN(0)
: toBN(args.amount) : toBN(args.amount)
.sub(providedFee) // args.amount includes fee .sub(providedFee) // args.amount includes fee
.mul(toBN(miningServiceFee * 1e10)) .mul(toBN(parseInt(miningServiceFee * 1e10)))
.div(toBN(1e10 * 100)) .div(toBN(1e10 * 100))
/* eslint-enable */ /* eslint-enable */
const desiredFee = expenseInPoints.add(serviceFeePercent) // in points const desiredFee = expenseInPoints.add(serviceFeePercent) // in points