Skip to content

Fix slippage calculation in swap minimum receive - #710

Merged
gemcoder21 merged 2 commits into
mainfrom
fix/swap-min-receive-slippage
Jul 16, 2026
Merged

Fix slippage calculation in swap minimum receive#710
gemcoder21 merged 2 commits into
mainfrom
fix/swap-min-receive-slippage

Conversation

@gemdev111

Copy link
Copy Markdown
Collaborator

The swap minimum receive divided slippage bps into whole percents, so fractional slippage (0.5% = 50 bps) truncated to 0% and displayed a higher minimum receive than the quote guarantees. Apply the basis points directly, on iOS and Android.

Minimum receive divided slippage bps by 100 into whole percent before
applying it, so sub-percent slippage truncated to zero: with 0.3% or
0.5% slippage (two of the three suggested values) the swap details
showed the full quote amount as the guaranteed minimum, and 1.5% was
applied as 1%.

Apply the slippage directly in basis points, matching how core and
Android compute it.
Minimum receive went through a double detour: bps to percent to
fraction via Double, folded into BigDecimal. Numerically it lands on the
same values, but it drifts from how core (apply_slippage_in_bp) and iOS
compute slippage. Use integer basis point math on the atomic value and
name the computation.
@gemdev111 gemdev111 self-assigned this Jul 16, 2026
@gemdev111 gemdev111 changed the title Apply slippage in basis points to swap minimum receive Fix slippage in swap minimum receive Jul 16, 2026
@gemdev111 gemdev111 changed the title Fix slippage in swap minimum receive Fix slippage calculation in swap minimum receive Jul 16, 2026
@gemcoder21
gemcoder21 merged commit cd073a7 into main Jul 16, 2026
2 checks passed
@gemcoder21
gemcoder21 deleted the fix/swap-min-receive-slippage branch July 16, 2026 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants