Skip to content

Commit 8f147f1

Browse files
authored
Avoid recomputing amountIn when exactIn and `amountRemainingLessF… (#718)
Avoid recomputing `amountIn` when `exactIn` and `amountRemainingLessFee < amountIn` Simplify the flow in SwapMath library by removing unnecessary calculations related to input amounts. The removed calculations are replaced with a direct assignment of the remaining amount which simplifies the logic. Moreover, the potential for any rounding issues is significantly reduced.
1 parent d47ecf9 commit 8f147f1

23 files changed

+26
-27
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1220
1+
1192
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1544
1+
1261
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1133
1+
1130
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1859
1+
1443
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
23947
1+
23924
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
108786
1+
108354

.forge-snapshots/simple swap.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
123629
1+
123197
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
126846
1+
126854
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
155069
1+
154637
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
105938
1+
105477

0 commit comments

Comments
 (0)