Skip to content

Commit

Permalink
fix(adapter-manager): Handle undefined chain-specific wrapEther config
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholaspai committed Oct 10, 2023
1 parent 8b10252 commit d3d739b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/clients/InventoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ export class InventoryClient {
async wrapL2EthIfAboveThreshold(): Promise<void> {
// If inventoryConfig is defined, there will 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");
Expand Down
4 changes: 2 additions & 2 deletions src/clients/bridges/AdapterManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ 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;

Check warning on line 87 in src/clients/bridges/AdapterManager.ts

View workflow job for this annotation

GitHub Actions / Lint (16)

Insert `⏎·········`
const wrapTarget = inventoryConfig?.wrapEtherTargetPerChain?.[chainId] ?? inventoryConfig.wrapEtherTarget;
assert(
wrapThreshold.gte(wrapTarget),
`wrapEtherThreshold ${wrapThreshold.toString()} must be >= wrapEtherTarget ${wrapTarget.toString()}`
Expand Down

0 comments on commit d3d739b

Please sign in to comment.