Skip to content

fix(swap): review large trade costs and verify split settlement - #460

Merged
BitHighlander merged 1 commit into
developfrom
fix/swap-risk-partial-settlement
Sep 26, 2026
Merged

BitHighlander merged 1 commit into
developfrom
fix/swap-risk-partial-settlement

Conversation

@BitHighlander

Copy link
Copy Markdown
Collaborator

Problem and behavior

A large swap could show an optimistic minimum and a green “Done” while a streaming protocol had paid only its first outbound leg. The saved quote could also be presented as the received amount. For example, THORChain inbound 0x5c3b317f…c4170 paid 2.16728726 Base ETH first and 1.55006707 Base ETH later; the first payout alone was below the 3.61863598 ETH memo minimum.

This change shows the transaction memo minimum when available, keeps quoted and received amounts separate, and lists each protocol payout. THORChain and Maya completion now requires settlement evidence; a payout total below the minimum remains in progress. Legacy completed records without payout evidence show “verifying” until refreshed. The review screen also visualizes quoted cost, extra slippage allowance, and minimum retained value.

For input trades worth at least $1,000, the swap UI warns at 0.5% expected loss, requires acknowledgment at 1% expected loss or 2% loss at minimum receive, and blocks a route at 5% expected loss. The threshold uses the input’s USD value. Unknown market prices are labeled and require acknowledgment. Smaller trades retain lighter fee warnings. Quotes for large or unknown-value trades refresh after 30 seconds before signing. The parser evaluates all buildable Pioneer routes and chooses the greatest quoted destination output.

Validation

  • 114 targeted Bun tests pass, including the recorded split-payout action and a synthetic early-completed first payout.
  • Backend bundle and Vite build pass from a clean develop worktree.
  • git diff --check passes.

Review limits

  • Cross-asset loss thresholds need independent prices. Newly listed assets without a trusted price require acknowledgment; their pool price impact is not quantified by this change.
  • Route comparison ranks quoted destination output. Source gas, settlement time, and provider reliability are not part of that ranking.
  • Payouts are reported by Midgard. The UI names them “reported” and links each outbound transaction; it does not independently verify every receipt.

@BitHighlander
BitHighlander merged commit 6112492 into develop Sep 26, 2026
5 checks passed
@BitHighlander
BitHighlander deleted the fix/swap-risk-partial-settlement branch September 26, 2026 04:53
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.

1 participant