Skip to content

Commit

Permalink
revert
Browse files Browse the repository at this point in the history
  • Loading branch information
Nikita committed Aug 15, 2023
1 parent 3f11d7a commit b8da512
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
5 changes: 1 addition & 4 deletions ride/lp.ride
Original file line number Diff line number Diff line change
Expand Up @@ -1011,7 +1011,7 @@ func calculateAmountOutForSwapAndSendTokens(cleanAmountIn: Int, isReverse: Boole
} else {
getStringOrFail(this, aa())
}
let poolAssetInBalance = getAccBalance(assetIn) - i.payments[0].value().amount
let poolAssetInBalance = getAccBalance(assetIn) - i.payments[0].value().amount - feePoolAmount
let poolAssetOutBalance = getAccBalance(assetOut)
let amountOut = fraction(poolAssetOutBalance, cleanAmountIn, poolAssetInBalance + cleanAmountIn)

Expand All @@ -1021,13 +1021,10 @@ 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

strict rebalanceState = rebalanceAsset(assetIn)
strict withdrawState = withdrawAndRebalanceAsset(assetOut, amountOut)
( withdrawState ++
rebalanceState ++
refreshKLpActions ++
[
ScriptTransfer(addressTo.addressFromStringValue(), amountOut, assetOut.parseAssetId())
],
Expand Down
5 changes: 2 additions & 3 deletions ride/lp_stable.ride
Original file line number Diff line number Diff line change
Expand Up @@ -1061,13 +1061,11 @@ 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

(
[
ScriptTransfer(addressTo.addressFromStringValue(), totalGetRaw, assetOut.parseAssetId())
] ++ refreshDLpActions,
],
totalGetRaw
)
}
Expand Down Expand Up @@ -1760,3 +1758,4 @@ func verify() = {
}
}
}

0 comments on commit b8da512

Please sign in to comment.