diff --git a/src/monitor/MonitorConfig.ts b/src/monitor/MonitorConfig.ts index 5c766512c..ee2e93140 100644 --- a/src/monitor/MonitorConfig.ts +++ b/src/monitor/MonitorConfig.ts @@ -1,6 +1,6 @@ import winston from "winston"; import { CommonConfig, ProcessEnv } from "../common"; -import { ethers, getNativeTokenAddressForChain } from "../utils"; +import { ethers, getNativeTokenAddressForChain, isDefined } from "../utils"; // Set modes to true that you want to enable in the AcrossMonitor bot. export interface BotModes { @@ -143,12 +143,12 @@ export class MonitorConfig extends CommonConfig { if (MONITORED_BALANCES) { this.monitoredBalances = JSON.parse(MONITORED_BALANCES).map( ({ errorThreshold, warnThreshold, account, token, chainId }) => { - if (!errorThreshold && !warnThreshold) { + if (!isDefined(errorThreshold) && !isDefined(warnThreshold)) { throw new Error("Must provide either an errorThreshold or a warnThreshold"); } let parsedErrorThreshold: number | null = null; - if (errorThreshold) { + if (isDefined(errorThreshold)) { if (Number.isNaN(Number(errorThreshold))) { throw new Error(`errorThreshold value: ${errorThreshold} cannot be converted to a number`); } @@ -156,7 +156,7 @@ export class MonitorConfig extends CommonConfig { } let parsedWarnThreshold: number | null = null; - if (warnThreshold) { + if (isDefined(warnThreshold)) { if (Number.isNaN(Number(errorThreshold))) { throw new Error(`warnThreshold value: ${warnThreshold} cannot be converted to a number`); }