Skip to content

Commit

Permalink
feat: add guard on max iterations on AlgebraMath
Browse files Browse the repository at this point in the history
  • Loading branch information
KanievskyiDanylo committed Nov 6, 2024
1 parent e56a0e5 commit 344590e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/dex/algebra/lib/AlgebraMath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,11 @@ class AlgebraMathClass {
tickCount: 0,
};
// swap until there is remaining input or output tokens or we reach the price limit
let iterationsCount = 0;
while (true) {
iterationsCount++;
_require(iterationsCount < 100, 'Max iteration reached on AlgebraMath');

step.stepSqrtPrice = currentPrice;

//equivalent of tickTable.nextTickInTheSameRow(currentTick, zeroToOne);
Expand Down

0 comments on commit 344590e

Please sign in to comment.