fix when fx is same cost token as fx - #438
Conversation
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit b128a53. Configure here.
| amount: sameTokenCost.toString() | ||
| }; | ||
| } | ||
| } |
There was a problem hiding this comment.
Unused same-token fees kept
Medium Severity
Estimate swaps that charge the fee in the from token fund expectedCost.max on the principal SEND, but excess over the live fee is not refundable when affinity is from. The unused buffer stays with the liquidity provider, and conversion.cost reports that gross overage instead of the fee actually charged.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b128a53. Configure here.





closes #435
Fixes a bug when the fee for an fx transfer is the same token that the user is expected to send to the anchor
Note
Medium Risk
Touches FX swap construction and settlement validation where token amounts must match quotes; incorrect merging or fee inference could mis-settle funds, though scope is narrow and covered by new tests.
Overview
Summary
FX swaps failed when the quoted fee used the same token as the amount sent to the anchor. The client could not keep a separate fee
SENDand the tagged principalSENDin one block, and the server rejected or mis-reported those exchanges.Related Issues
Closes #435
Changes Made
SENDwhen the fee token matches thefromtokenSENDs of the same token instead of rejecting themfrom-token sends (net of refunds) when there is no separate feeSENDTesting
createExchange succeeds when FX fee is charged in the send tokeninclient.test.ts(end-to-end quote, balances,getExchangeStatusconversion)util.test.tscases for dual same-tokenSENDblocks (quote-based and non-quote)Breaking Changes
None
Reviewed by Cursor Bugbot for commit b128a53. Configure here.