Skip to content

fix: don't return tx when user doesn't have enough funds #556

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

guibescos
Copy link
Contributor

@guibescos guibescos commented May 14, 2025

There's an edgecase that produces on-chain failures (InsufficientUserFunds errors) which is the following.
The user has 1 SOL and he wants to trade for USDC. He requests a quote for 1 SOL, because he has a lot of SOL he's supposed to pay for token accounts, but after he pays for the token accounts he no longer has 1 SOL.

Normally when the user doens't have enough funds we don't return the transaction to the user, but here yes because of flawed logic.

This happened this morning:
https://solscan.io/tx/3vniKPxn6EbUjZXrV2gquiPaasS4vCeZcGSxdF5dxztmPdZQskKLC47nX4MFXV2BYoAuB72UHgyimnHanukhKnzR

This shouldn't happen to normal users since normally frontends don't let you trade your full balance (and leave some SOL for token creations).

Copy link

vercel bot commented May 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
swap-staging ⬜️ Ignored (Inspect) Visit Preview May 14, 2025 2:40pm

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