Skip to content

Commit ea4ff6c

Browse files
Make more CL operation mutative (#7692) (#7693)
(cherry picked from commit fb84df2) Co-authored-by: Dev Ojha <ValarDragon@users.noreply.github.com>
1 parent d2be194 commit ea4ff6c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

x/concentrated-liquidity/swaps.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ func (k Keeper) computeOutAmtGivenIn(
493493

494494
// Coin amounts require int values
495495
// Round amountIn up to avoid under charging
496-
amountIn := (tokenInMin.Amount.ToLegacyDec().Sub(swapState.amountSpecifiedRemaining)).Ceil().TruncateInt()
496+
amountIn := (tokenInMin.Amount.ToLegacyDec().SubMut(swapState.amountSpecifiedRemaining)).Ceil().TruncateInt()
497497
// Round amountOut down to avoid over distributing.
498498
amountOut := swapState.amountCalculated.TruncateInt()
499499

@@ -620,7 +620,7 @@ func (k Keeper) computeInAmtGivenOut(
620620
amountIn := swapState.amountCalculated.Ceil().TruncateInt()
621621

622622
// Round amount out down to avoid over charging the pool.
623-
amountOut := desiredTokenOut.Amount.ToLegacyDec().Sub(swapState.amountSpecifiedRemaining).TruncateInt()
623+
amountOut := desiredTokenOut.Amount.ToLegacyDec().SubMut(swapState.amountSpecifiedRemaining).TruncateInt()
624624

625625
ctx.Logger().Debug("final amount in", amountIn)
626626
ctx.Logger().Debug("final amount out", amountOut)

0 commit comments

Comments
 (0)