From 8f5b673f3bc587cbbe372b9e8d1182c4a52fc3aa Mon Sep 17 00:00:00 2001 From: Danil Kovtonyuk Date: Wed, 8 Sep 2021 17:37:49 +1000 Subject: [PATCH] feat: add env baseFeeReserve variable --- .env.example | 1 + README.md | 1 + src/config.js | 1 + src/worker.js | 8 +++++++- 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.env.example b/.env.example index 6d8191e..2a07bf1 100644 --- a/.env.example +++ b/.env.example @@ -20,4 +20,5 @@ CONFIRMATIONS=4 # in GWEI MAX_GAS_PRICE=1000 +BASE_FEE_RESERVE_PERCENTAGE=25 AGGREGATOR=0x8cb1436F64a3c33aD17bb42F94e255c4c0E871b2 diff --git a/README.md b/README.md index 8460da9..0bcceb9 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ wget https://raw.githubusercontent.com/tornadocash/tornado-relayer/master/.env.e - update `AGGREGATOR` if needed - Contract address of aggregator instance. - update `CONFIRMATIONS` if needed - how many block confirmations to wait before processing an event. Not recommended to set less than 3 - update `MAX_GAS_PRICE` if needed - maximum value of gwei value for relayer's transaction + - update `BASE_FEE_RESERVE_PERCENTAGE` if needed - how much in % will the network baseFee increase If you want to use more than 1 eth address for relaying transactions, please add as many `workers` as you want. For example, you can comment out `worker2` in docker-compose.yml file, but please use a different `PRIVATE_KEY` for each worker. diff --git a/src/config.js b/src/config.js index 3426bf5..7981f69 100644 --- a/src/config.js +++ b/src/config.js @@ -26,4 +26,5 @@ module.exports = { [jobType.MINING_WITHDRAW]: 400000, }, minimumBalance: '1000000000000000000', + baseFeeReserve: Number(process.env.BASE_FEE_RESERVE_PERCENTAGE), } diff --git a/src/worker.js b/src/worker.js index 7874cee..c49576f 100644 --- a/src/worker.js +++ b/src/worker.js @@ -22,6 +22,7 @@ const { privateKey, httpRpcUrl, oracleRpcUrl, + baseFeeReserve, miningServiceFee, tornadoServiceFee, tornadoGoerliProxy, @@ -79,7 +80,12 @@ async function start() { txManager = new TxManager({ privateKey, rpcUrl: httpRpcUrl, - config: { CONFIRMATIONS, MAX_GAS_PRICE, THROW_ON_REVERT: false, BASE_FEE_RESERVE_PERCENTAGE: 25 }, + config: { + CONFIRMATIONS, + MAX_GAS_PRICE, + THROW_ON_REVERT: false, + BASE_FEE_RESERVE_PERCENTAGE: baseFeeReserve, + }, }) swap = new web3.eth.Contract(swapABI, await resolver.resolve(torn.rewardSwap.address)) minerContract = new web3.eth.Contract(miningABI, await resolver.resolve(torn.miningV2.address))