make normal relayer's fee

This commit is contained in:
Roman Storm 2019-11-26 12:34:52 -08:00
parent 1edc8ff69c
commit ffb9043b60
3 changed files with 4 additions and 4 deletions

@ -3,7 +3,7 @@ RPC_URL=https://kovan.infura.io/v3/a3f4d001c1fc4a359ea70dd27fd9cb51
PRIVATE_KEY=
ETH_MIXER_ADDRESS=0x1Cea940cA15a303A0E01B7F8589F39fF34308DB2
DAI_MIXER_ADDRESS=0x7ed3fC8042e18db889A0466F49c438bB1410b3c7
# 25 means 2.5%
RELAYER_FEE=25
# 2.5 means 2.5%
RELAYER_FEE=2.5
APP_PORT=8000

@ -44,4 +44,4 @@ console.log(`mixers: ${JSON.stringify(mixers)}`)
console.log(`gasPrices: ${JSON.stringify(fetcher.gasPrices)}`)
console.log(`netId: ${netId}`)
console.log(`ethPrices: ${JSON.stringify(fetcher.ethPrices)}`)
console.log(`Service fee: ${relayerServiceFee / 10}%`)
console.log(`Service fee: ${relayerServiceFee}%`)

@ -58,7 +58,7 @@ function sleep(ms) {
function isEnoughFee({ gas, gasPrices, currency, amount, refund, ethPrices, fee }) {
// TODO tokens can have less then 18 decimals
const feePercent = toBN(toWei(amount)).mul(toBN(relayerServiceFee)).div(toBN('1000'))
const feePercent = toBN(toWei(amount)).mul(toBN(Number(relayerServiceFee) * 10)).div(toBN('1000'))
const expense = toBN(toWei(gasPrices.fast.toString(), 'gwei')).mul(toBN(gas))
let desiredFee
switch (currency) {