diff --git a/apps/alpha-liquidator/src/liquidator.ts b/apps/alpha-liquidator/src/liquidator.ts index 9a5de2255c..28fc339c0e 100644 --- a/apps/alpha-liquidator/src/liquidator.ts +++ b/apps/alpha-liquidator/src/liquidator.ts @@ -387,9 +387,9 @@ class Liquidator { debug("Swapping any remaining non-usdc to usdc"); const banks = this.client.banks.values(); const usdcBank = this.client.getBankByMint(USDC_MINT)!; - await Promise.all([...banks].map(async (bank) => { + for (const bank of banks) { if (bank.mint.equals(USDC_MINT)) { - return; + continue; } let uiAmount = await this.getTokenAccountBalance(bank.mint, false); @@ -399,7 +399,7 @@ class Liquidator { if (usdValue.lte(DUST_THRESHOLD_UI)) { // debug!("Not enough %s to swap, skipping...", this.getTokenSymbol(bank)); - return; + continue; } else { debug("Account has %d ($%d) %s", uiAmount, usdValue, this.getTokenSymbol(bank)); } @@ -418,14 +418,14 @@ class Liquidator { if (uiAmount.lte(DUST_THRESHOLD_UI)) { debug("Account has no more %s, skipping...", this.getTokenSymbol(bank)); - return; + continue; } } debug("Swapping %d %s to USDC", uiAmount, this.getTokenSymbol(bank)); await this.swap(bank.mint, USDC_MINT, uiToNative(uiAmount, bank.mintDecimals)); - })); + } const usdcBalance = await this.getTokenAccountBalance(USDC_MINT); diff --git a/yarn.lock b/yarn.lock index 9eba0fd8d8..0efb4c5d5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -12132,13 +12132,6 @@ cross-fetch@3.0.6: dependencies: node-fetch "2.6.1" -cross-fetch@3.1.5: - version "3.1.5" - resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" - integrity sha512-lvb1SBsI0Z7GDwmuid+mU3kWVBwTVUbe7S0H52yaaAdQOXq2YktTCZdlAcNKFzE6QtRz0snpw9bNiPeOIkkQvw== - dependencies: - node-fetch "2.6.7" - cross-fetch@3.1.6: version "3.1.6" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.6.tgz#bae05aa31a4da760969756318feeee6e70f15d6c"