Skip to content

Commit 6282efa

Browse files
authored
Merge pull request #16 from initia-labs/fix/minitswap-sub-overflow
Fix/minitswap sub overflow
2 parents 9cabe9a + 172e9e1 commit 6282efa

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed
13 Bytes
Binary file not shown.

precompile/modules/initia_stdlib/sources/minitswap.move

+6
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,12 @@ module initia_std::minitswap {
833833
// when fully recovered rate is too close to 0.5 y can be same with sim_size
834834
if (y == sim_size) break;
835835

836+
// when fully recovered rate is too close to 0.5 x can be slightly higher than sim_size
837+
if (x > sim_size) {
838+
x = sim_size;
839+
break
840+
};
841+
836842
if (x > x_prev) {
837843
if (x - x_prev <= 1) break
838844
} else {

0 commit comments

Comments
 (0)