diff --git a/src/config.ts b/src/config.ts index df9f070..57bf45c 100644 --- a/src/config.ts +++ b/src/config.ts @@ -6,12 +6,12 @@ import { version } from '../package.json'; config(); const isProduction = process.env.NODE_ENV === 'production'; export const relayerVersion = version; -export const netId = Number(process.env.NET_ID || 1); +export const netId = Number(process.env.NET_ID ?? 1); export const redisUrl = process.env.REDIS_URL || 'redis://127.0.0.1:6379'; export const rpcUrl = process.env.HTTP_RPC_URL; -export const CONFIRMATIONS = Number(process.env.CONFIRMATIONS) || 4; -export const MAX_GAS_PRICE = Number(process.env.MAX_GAS_PRICE) || 1000; -export const BASE_FEE_RESERVE_PERCENTAGE = Number(process.env.BASE_FEE_RESERVE_PERCENTAGE) || 25; +export const CONFIRMATIONS = Number(process.env.CONFIRMATIONS ?? 4); +export const MAX_GAS_PRICE = Number(process.env.MAX_GAS_PRICE ?? 1000); +export const BASE_FEE_RESERVE_PERCENTAGE = Number(process.env.BASE_FEE_RESERVE_PERCENTAGE ?? 25); export const mainnetRpcUrl = process.env.MAINNET_RPC_URL || process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/'; export const oracleRpcUrl = process.env.ORACLE_RPC_URL || 'https://mainnet.infura.io/'; export const offchainOracleAddress = '0x07D91f5fb9Bf7798734C3f606dB065549F6893bb'; diff --git a/src/services/health.service.ts b/src/services/health.service.ts index 55eea33..6afdfe3 100644 --- a/src/services/health.service.ts +++ b/src/services/health.service.ts @@ -83,7 +83,7 @@ export class HealthService { await this.store.client.zadd('errors:code', 'INCR', 1, e?.code || 'RUNTIME_ERROR'); await this.store.client.zadd('errors:log', 'INCR', 1, e.message); - if (e?.code === 'REVERTED') { + if (e?.code === 'REVERTED' || e?.code === 'SEND_ERROR') { const jobUrl = `${this.config.host}/v1/jobs/${jobId}`; await this.pushAlert({ message: `${e.message} \n ${jobUrl}`, @@ -108,7 +108,7 @@ export class HealthService { } else if (value.lt(this.config.balances[currency].warn)) { level = 'WARN'; } - const msg = { WARN: 'Please refill your balance', CRITICAL: 'Insufficient balance' }; + const msg = { WARN: 'Please refill your balance', CRITICAL: 'Insufficient balance', OK: 'ok' }; const alert = { type: `${type}_${currency}_${level}`, message: `${msg[level]} ${formatEther(value)} ${currency === 'MAIN' ? this.config.nativeCurrency : 'torn'}`,