Skip to content

Commit

Permalink
chore: remove while loop on nomempoolloop
Browse files Browse the repository at this point in the history
  • Loading branch information
SirTLB committed Apr 5, 2023
1 parent d548126 commit df7195b
Showing 1 changed file with 11 additions and 15 deletions.
26 changes: 11 additions & 15 deletions src/core/types/arbitrageloops/nomempoolLoop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down

0 comments on commit df7195b

Please sign in to comment.