From 340df8bdd1ec7f169dcc7e23b0acb824b307da69 Mon Sep 17 00:00:00 2001
From: smart_ex <sergei.smart@gmail.com>
Date: Fri, 29 Jul 2022 18:42:55 +1000
Subject: [PATCH] cleanup

---
 .github/workflows/build.yml    | 162 ++++++++++++++++-----------------
 redis.conf                     |   4 -
 src/config.ts                  |   9 +-
 src/sandbox.ts                 |  12 ---
 src/services/config.service.ts |   2 -
 src/services/tx.service.ts     |   1 -
 6 files changed, 81 insertions(+), 109 deletions(-)
 delete mode 100644 redis.conf
 delete mode 100644 src/sandbox.ts

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 3696d7c..e7212e1 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -2,8 +2,8 @@ name: build
 
 on:
   push:
-    branches: ['*']
-    tags: ['v[0-9]+.[0-9]+.[0-9]+']
+    branches: [ '*' ]
+    tags: [ 'v[0-9]+.[0-9]+.[0-9]+' ]
   pull_request:
 
 jobs:
@@ -15,85 +15,81 @@ jobs:
       - uses: actions/setup-node@v1
         with:
           node-version: 16
-      - run: yarn install --network-concurrency=2
-      #      - run: yarn test
+      - run: yarn install
       - run: yarn lint
-#      - name: Telegram Failure Notification
-#        uses: appleboy/telegram-action@master
-#        if: failure()
-#        with:
-#          message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
-#          format: markdown
-#          to: ${{ secrets.TELEGRAM_CHAT_ID }}
-#          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
-#  TODO: Edit this step
-#  publish:
-#    runs-on: ubuntu-latest
-#    needs: build
-#    if: startsWith(github.ref, 'refs/tags')
-#    steps:
-#      - name: Checkout
-#        uses: actions/checkout@v2
-#
-#      - name: Set vars
-#        id: vars
-#        run: |
-#          echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/v})"
-#          echo "::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/})"
-#
-#      - name: Check package.json version vs tag
-#        run: |
-#          [ ${{ steps.vars.outputs.version }} = $(grep '"version":' package.json | grep -o "[0-9.]*") ] || (echo "Git tag doesn't match version in package.json" && false)
-#
-#      - name: Build and push Docker image
-#        uses: docker/build-push-action@v1.1.0
-#        with:
-#          dockerfile: Dockerfile
-#          repository: tornadocash/relayer
-#          tag_with_ref: true
-#          tags: candidate
-#          username: ${{ secrets.DOCKER_USERNAME }}
-#          password: ${{ secrets.DOCKER_TOKEN }}
-#
-#      - name: Telegram Message Notify
-#        uses: appleboy/telegram-action@master
-#        with:
-#          to: ${{ secrets.TELEGRAM_CHAT_ID }}
-#          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
-#          message: 🚀 Published a [${{ steps.vars.outputs.repo_name }}](https://github.com/${{ github.repository }}) version ${{ steps.vars.outputs.version }} to docker hub
-#          debug: true
-#          format: markdown
-#
-#      - name: Telegram Relayer Channel Notification
-#        uses: appleboy/telegram-action@master
-#        with:
-#          to: ${{ secrets.TELEGRAM_RELAYER_CHAT_ID }}
-#          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
-#          message: |
-#            🚀 Published a new version of the relayer node service for mainnet to docker hub: `tornadocash/relayer:v${{ steps.vars.outputs.version }}` and `tornadocash/relayer:mining`.
-#
-#            ❗️Please update your mainnet nodes ❗️
-#            DO NOT TOUCH SIDECHAINS AND NOVA RELAYERS.
-#
-#          debug: true
-#          format: markdown
-#
-#      - name: Discord Relayer Channel Notification
-#        env:
-#          DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELAYER_WEBHOOK }}
-#        uses: Ilshidur/action-discord@master
-#        with:
-#          args: |
-#            🚀 Published a new version of the relayer node service for mainnet to docker hub: `tornadocash/relayer:v${{ steps.vars.outputs.version }}` and `tornadocash/relayer:mining`.
-#
-#            ❗️Please update your mainnet nodes ❗️
-#            DO NOT TOUCH SIDECHAINS AND NOVA RELAYERS.
-#
-#      - name: Telegram Failure Notification
-#        uses: appleboy/telegram-action@master
-#        if: failure()
-#        with:
-#          message: ❗ Failed to publish [${{ steps.vars.outputs.repo_name }}](https://github.com/${{ github.repository }}/actions):v${{ steps.vars.outputs.version }} for mainnet because of ${{ github.actor }}
-#          format: markdown
-#          to: ${{ secrets.TELEGRAM_CHAT_ID }}
-#          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+      - name: Telegram Failure Notification
+        uses: appleboy/telegram-action@master
+        if: failure()
+        with:
+          message: ❗ Build failed for [${{ github.repository }}](https://github.com/${{ github.repository }}/actions) because of ${{ github.actor }}
+          format: markdown
+          to: ${{ secrets.TELEGRAM_CHAT_ID }}
+          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+  publish:
+    runs-on: ubuntu-latest
+    needs: build
+    if: startsWith(github.ref, 'refs/tags')
+    steps:
+      - name: Checkout
+        uses: actions/checkout@v2
+
+      - name: Set vars
+        id: vars
+        run: |
+          echo "::set-output name=version::$(echo ${GITHUB_REF#refs/tags/v})"
+          echo "::set-output name=repo_name::$(echo ${GITHUB_REPOSITORY#*/})"
+
+      - name: Check package.json version vs tag
+        run: |
+          [ ${{ steps.vars.outputs.version }} = $(grep '"version":' package.json | grep -o "[0-9.]*") ] || (echo "Git tag doesn't match version in package.json" && false)
+
+      - name: Build and push Docker image
+        uses: docker/build-push-action@v1.1.0
+        with:
+          dockerfile: Dockerfile
+          repository: tornadocash/relayer
+          tag_with_ref: true
+          tags: candidate
+          username: ${{ secrets.DOCKER_USERNAME }}
+          password: ${{ secrets.DOCKER_TOKEN }}
+
+      - name: Telegram Message Notify
+        uses: appleboy/telegram-action@master
+        with:
+          to: ${{ secrets.TELEGRAM_CHAT_ID }}
+          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+          message: 🚀 Published a [${{ steps.vars.outputs.repo_name }}](https://github.com/${{ github.repository }}) version ${{ steps.vars.outputs.version }} to docker hub
+          debug: true
+          format: markdown
+
+      - name: Telegram Relayer Channel Notification
+        uses: appleboy/telegram-action@master
+        with:
+          to: ${{ secrets.TELEGRAM_RELAYER_CHAT_ID }}
+          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
+          message: |
+            🚀 Published a new version of the relayer node service for mainnet to docker hub: `tornadocash/relayer:v${{ steps.vars.outputs.version }}` and `tornadocash/relayer`.
+
+            ❗️Please update your mainnet nodes ❗️
+
+          debug: true
+          format: markdown
+
+      - name: Discord Relayer Channel Notification
+        env:
+          DISCORD_WEBHOOK: ${{ secrets.DISCORD_RELAYER_WEBHOOK }}
+        uses: Ilshidur/action-discord@master
+        with:
+          args: |
+            🚀 Published a new version of the relayer node service for mainnet to docker hub: `tornadocash/relayer:v${{ steps.vars.outputs.version }}` and `tornadocash/relayer`.
+
+            ❗️Please update your mainnet nodes ❗️
+
+      - name: Telegram Failure Notification
+        uses: appleboy/telegram-action@master
+        if: failure()
+        with:
+          message: ❗ Failed to publish [${{ steps.vars.outputs.repo_name }}](https://github.com/${{ github.repository }}/actions):v${{ steps.vars.outputs.version }} for mainnet because of ${{ github.actor }}
+          format: markdown
+          to: ${{ secrets.TELEGRAM_CHAT_ID }}
+          token: ${{ secrets.TELEGRAM_BOT_TOKEN }}
diff --git a/redis.conf b/redis.conf
deleted file mode 100644
index 01ca1ae..0000000
--- a/redis.conf
+++ /dev/null
@@ -1,4 +0,0 @@
-timeout 0
-tcp-keepalive 0
-databases 1
-save 60 100000
diff --git a/src/config.ts b/src/config.ts
index e7f99a8..8e21437 100644
--- a/src/config.ts
+++ b/src/config.ts
@@ -16,7 +16,6 @@ export const mainnetRpcUrl = process.env.MAINNET_RPC_URL || process.env.ORACLE_R
 export const oracleRpcUrl = process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/';
 export const offchainOracleAddress = '0x07D91f5fb9Bf7798734C3f606dB065549F6893bb';
 export const multiCallAddress = '0xda3c19c6fe954576707fa24695efb830d9cca1ca';
-export const aggregatorAddress = process.env.AGGREGATOR;
 export const privateKey = process.env.PRIVATE_KEY;
 export const instances = tornConfig.instances;
 export const torn = tornConfig;
@@ -24,7 +23,6 @@ export const port = Number(process.env.APP_PORT) || 8000;
 export const host = isProduction ? 'https://' + process.env.VIRTUAL_HOST : `http://localhost:${port}`;
 export const tornadoServiceFee = Number(process.env.REGULAR_TORNADO_WITHDRAW_FEE);
 export const rewardAccount = process.env.REWARD_ACCOUNT;
-export const governanceAddress = '0x5efda50f22d34F262c29268506C5Fa42cB56A1Ce';
 export const tornadoGoerliProxy = '0x454d870a72e29d5E5697f635128D18077BD04C60';
 export const ovmGasPriceOracleContract = '0x420000000000000000000000000000000000000F';
 export const txJobAttempts = 3;
@@ -34,11 +32,8 @@ export const gasLimits = {
   [RelayerJobType.OP_TORNADO_WITHDRAW]: 440000,
   [RelayerJobType.ARB_TORNADO_WITHDRAW]: 1900000,
 };
-// export const minimumBalance = '1000000000000000000';
-// export const minimumTornBalance = '30000000000000000000';
-// TODO: remove this
-export const minimumBalance = '10000000000000000';
-export const minimumTornBalance = '0';
+export const minimumBalance = '1000000000000000000';
+export const minimumTornBalance = '30000000000000000000';
 export const baseFeeReserve = Number(process.env.BASE_FEE_RESERVE_PERCENTAGE);
 export const tornToken = {
   tokenAddress: '0x77777FeDdddFfC19Ff86DB637967013e6C6A116C',
diff --git a/src/sandbox.ts b/src/sandbox.ts
deleted file mode 100644
index 01331e9..0000000
--- a/src/sandbox.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-import 'reflect-metadata';
-import { configService, getHealthService } from './services';
-
-(async () => {
-  try {
-    await configService.init();
-    const healthService = getHealthService();
-    console.log(healthService);
-  } catch (e) {
-    console.error('Top level catch', e);
-  }
-})();
diff --git a/src/services/config.service.ts b/src/services/config.service.ts
index a68b9a8..9735c20 100644
--- a/src/services/config.service.ts
+++ b/src/services/config.service.ts
@@ -139,8 +139,6 @@ export class ConfigService {
           )
           .filter(Boolean);
       }
-      // TODO get instances from registry
-
       console.log(
         'Configuration completed\n',
         `-- netId: ${this.netId}\n`,
diff --git a/src/services/tx.service.ts b/src/services/tx.service.ts
index 2da515d..696c338 100644
--- a/src/services/tx.service.ts
+++ b/src/services/tx.service.ts
@@ -152,7 +152,6 @@ export class TxService {
     const { currency, amount, decimals } = instance;
     const [fee, refund] = [args[4], args[5]].map(BigNumber.from);
     const gasPrice = await this.getGasPrice();
-    // TODO check refund value
     let gasLimit = this.gasLimit;
     if (!this.config.isLightMode) {
       gasLimit = gasLimits[RelayerJobType.TORNADO_WITHDRAW];