Skip to content

Commit

Permalink
explanatory comment to indicate the rounding down of LPTokens and amo…
Browse files Browse the repository at this point in the history
…unts
  • Loading branch information
ckeshava committed Apr 9, 2024
1 parent 31b8971 commit 5302b30
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ripple/app/misc/impl/AMMHelpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,11 @@ adjustAmountsByLPTokens(
std::uint16_t tfee,
bool isDeposit)
{
// If lpTokens contains a fractional part and at least 16 significant
// digits, it is possible that lpTokensActual is rounded down. This is to
// ensure that we don't create/burn more LPTokens (depending on
// whether it's AMMDeposit or AMMWithdraw transaction) than what the trader
// asked for.
auto const lpTokensActual =
adjustLPTokens(lptAMMBalance, lpTokens, isDeposit);

Expand Down

0 comments on commit 5302b30

Please sign in to comment.