From df7195b853252186e6c13dd1310c41626b592ad9 Mon Sep 17 00:00:00 2001 From: 0xBossanova <0xBossanova@proton.me> Date: Wed, 5 Apr 2023 15:47:22 +0200 Subject: [PATCH] chore: remove while loop on nomempoolloop --- .../types/arbitrageloops/nomempoolLoop.ts | 26 ++++++++----------- 1 file changed, 11 insertions(+), 15 deletions(-) diff --git a/src/core/types/arbitrageloops/nomempoolLoop.ts b/src/core/types/arbitrageloops/nomempoolLoop.ts index c3e57bf..581540e 100644 --- a/src/core/types/arbitrageloops/nomempoolLoop.ts +++ b/src/core/types/arbitrageloops/nomempoolLoop.ts @@ -74,24 +74,20 @@ export class NoMempoolLoop { * */ public async step() { - while (true) { - this.iterations++; - await this.updateStateFunction(this.chainOperator, this.pools); + this.iterations++; + await this.updateStateFunction(this.chainOperator, this.pools); - const arbTrade: OptimalTrade | undefined = this.arbitrageFunction(this.paths, this.botConfig); + const arbTrade: OptimalTrade | undefined = this.arbitrageFunction(this.paths, this.botConfig); - if (arbTrade) { - console.log(inspect(arbTrade.path.pools, { showHidden: true, depth: 4, colors: true })); - console.log(inspect(arbTrade.offerAsset, { showHidden: true, depth: 3, colors: true })); - console.log("expected profit: ", arbTrade.profit); - await this.trade(arbTrade); - this.cdPaths(arbTrade.path); - break; - } - - await delay(1500); + if (arbTrade) { + console.log(inspect(arbTrade.path.pools, { showHidden: true, depth: 4, colors: true })); + console.log(inspect(arbTrade.offerAsset, { showHidden: true, depth: 3, colors: true })); + console.log("expected profit: ", arbTrade.profit); + await this.trade(arbTrade); + this.cdPaths(arbTrade.path); } - return; + + await delay(1500); } /**