-
Notifications
You must be signed in to change notification settings - Fork 7
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
feat: return a quote when not enough funds #418
base: main
Are you sure you want to change the base?
Conversation
guibescos
commented
Mar 6, 2025
•
edited
Loading
edited
- in auction service, we let through transactions that fail with the user insufficient funds error
- in opportunity service, we check if the user has enough funds and set tx in the response to none if they don't
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
== InstructionError::Custom(ErrorCode::InsufficientUserFunds.into()) | ||
{ | ||
// This path only works as long as none of the other accepted programs use this error number, which is currently true since express relay is the only program in the whitelist that uses anchor error codes | ||
// TODO: Also check the instruction index here so we are sure it's coming from the swap instruction |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wouldn't this TODO resolve the above comment? since ER doesn't make any CPIs to anything except system & token program?
Some(_) => ( | ||
let user_has_enough_balance = | ||
if let Some(user_wallet_address) = input.quote_create.user_wallet_address { | ||
self.check_user_token_balance(CheckUserTokenBalanceInput { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we checking here to prevent sybiling? why do we need to make an RPC call every time a quote is requested? couldn't we just avoid this check and use the error code itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it seems we could handle this in verification.rs and just return a third option to allow the bid to remain with a flag that this failed due to UserInsufficientFunds
. then we don't have to recheck the token balance on chain?