Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ridev6 committed Aug 16, 2023
1 parent 602d3ef commit abd2eb9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 11 additions & 1 deletion ride/lp.ride
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,17 @@ func calculateAmountOutForSwapAndSendTokens(cleanAmountIn: Int, isReverse: Boole
strict checkK = newK >= oldK || "new K is fewer error".throw()
strict checkMin = amountOutMin <= amountOut || "Exchange result is fewer coins than expected".throw()

strict refreshKLpActions = refreshKLpInternal(0, 0, 0)._1
let amountAssetBalanceDelta = if (isReverse) then {
-amountOut
} else {
feePoolAmount
}
let priceAssetBalanceDelta = if (isReverse) then {
feePoolAmount
} else {
-amountOut
}
strict refreshKLpActions = refreshKLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1

strict rebalanceState = rebalanceAsset(assetIn)
strict withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
Expand Down
12 changes: 11 additions & 1 deletion ride/lp_stable.ride
Original file line number Diff line number Diff line change
Expand Up @@ -1062,7 +1062,17 @@ func calculateAmountOutForSwapAndSendTokens(cleanAmountIn: Int, isReverse: Boole
let newD = newXp.getD()
strict checkD = newD >= D || "new D is fewer error".throw()

strict refreshDLpActions = refreshDLpInternal(0, 0, 0)._1
let amountAssetBalanceDelta = if (isReverse) then {
-totalGetRaw
} else {
feePoolAmount
}
let priceAssetBalanceDelta = if (isReverse) then {
feePoolAmount
} else {
-totalGetRaw
}
strict refreshDLpActions = refreshDLpInternal(amountAssetBalanceDelta, priceAssetBalanceDelta, 0)._1

(
[
Expand Down

0 comments on commit abd2eb9

Please sign in to comment.