diff --git a/src/clients/InventoryClient.ts b/src/clients/InventoryClient.ts index ffca512bc..8667b2bfe 100644 --- a/src/clients/InventoryClient.ts +++ b/src/clients/InventoryClient.ts @@ -634,9 +634,9 @@ export class InventoryClient { } async wrapL2EthIfAboveThreshold(): Promise { - // If inventoryConfig is defined, there will be a default wrapEtherTarget and wrapEtherThreshold + // If inventoryConfig is defined, there should be a default wrapEtherTarget and wrapEtherThreshold // set by RelayerConfig.ts - if (!this?.inventoryConfig) { + if (!this?.inventoryConfig?.wrapEtherThreshold || !this?.inventoryConfig?.wrapEtherTarget) { return; } this.log("Checking ETH->WETH Wrap status"); diff --git a/src/clients/bridges/AdapterManager.ts b/src/clients/bridges/AdapterManager.ts index d3329d518..3ee1fe64c 100644 --- a/src/clients/bridges/AdapterManager.ts +++ b/src/clients/bridges/AdapterManager.ts @@ -84,8 +84,9 @@ export class AdapterManager { await utils.mapAsync( this.chainsToWrapEtherOn.filter((chainId) => isDefined(this.spokePoolClients[chainId])), async (chainId) => { - const wrapThreshold = inventoryConfig.wrapEtherThresholdPerChain[chainId] ?? inventoryConfig.wrapEtherThreshold; - const wrapTarget = inventoryConfig.wrapEtherTargetPerChain[chainId] ?? inventoryConfig.wrapEtherTarget; + const wrapThreshold = + inventoryConfig?.wrapEtherThresholdPerChain?.[chainId] ?? inventoryConfig.wrapEtherThreshold; + const wrapTarget = inventoryConfig?.wrapEtherTargetPerChain?.[chainId] ?? inventoryConfig.wrapEtherTarget; assert( wrapThreshold.gte(wrapTarget), `wrapEtherThreshold ${wrapThreshold.toString()} must be >= wrapEtherTarget ${wrapTarget.toString()}`