feat: buy currencies with other currencies#499
Closed
raulriera wants to merge 3 commits into
Closed
Conversation
Adds a payment-currency step to the buy flow: USDF or any launchpad token can fund a buy via the launchpad-to-launchpad StatefulSwap. Fixes multi-lookup-table account ordering in the transaction compiler and the funds gate's cross-rate compare.
raulriera
force-pushed
the
buy-currencies-with-currencies-93fb9f
branch
from
July 17, 2026 16:09
dd1e6b6 to
33d7390
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Buying a currency now goes through a payment-currency step: enter an amount (capped at your highest spendable balance), pick what to pay with — USDF or any other currency you hold — and confirm. Paying with a currency routes through the launchpad-to-launchpad swap, showing the pool's 1% exchange fee up front; paying with USDF keeps the simple summary. If the amount plus fee doesn't fit the selected balance, Buy offers to switch to the maximum amount instead. The currency being bought is excluded from the payment list, and with nothing spendable the amount screen becomes an Add Money shortcut.
Along the way this fixes two latent bugs the new path exposed: the transaction compiler ordered lookup-table accounts globally instead of grouped by table (invisible until the first two-table transaction), and the funds gate compared amounts across two different exchange rates, which could crash on a pinned quote after a rate tick.
Since entry is now capped at spendable balances, the old enter-more-to-fund shortcut is gone; the funding regression tests enter Add Money from the wallet instead.