update env config, send alerts for SEND_ERROR code

This commit is contained in:
smart_ex 2022-07-05 20:35:20 +10:00
parent 0e1a9043be
commit 29fa454428
2 changed files with 6 additions and 6 deletions

@ -6,12 +6,12 @@ import { version } from '../package.json';
config();
const isProduction = process.env.NODE_ENV === 'production';
export const relayerVersion = version;
export const netId = <availableIds>Number(process.env.NET_ID || 1);
export const netId = <availableIds>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';

@ -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'}`,