Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(adapter-manager): Catch undefined per-chain wrapEther config #984

Merged
merged 6 commits into from
Oct 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/clients/InventoryClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,9 @@ export class InventoryClient {
}

async wrapL2EthIfAboveThreshold(): Promise<void> {
// 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");
Expand Down
5 changes: 3 additions & 2 deletions src/clients/bridges/AdapterManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()}`
Expand Down