Skip to content
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

fix(swap): fix swap out of market #3576

Merged
merged 3 commits into from
Jan 10, 2024
Merged

Conversation

alfetopito
Copy link
Collaborator

Summary

Fixes #3561

Swap orders should show out of the market again.

Screenshot 2024-01-05 at 16 28 04

Screenshot 2024-01-05 at 16 28 18

To Test

Check the instructions on #3561

Copy link

vercel bot commented Jan 5, 2024

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

Name Status Preview Updated (UTC)
cosmos ✅ Ready (Inspect) Visit Preview Jan 10, 2024 3:40pm
explorer ✅ Ready (Inspect) Visit Preview Jan 10, 2024 3:40pm
swap-dev ✅ Ready (Inspect) Visit Preview Jan 10, 2024 3:40pm
widget-configurator ✅ Ready (Inspect) Visit Preview Jan 10, 2024 3:40pm

Comment on lines +226 to +227
// Don't quote if there's nothing left to match in this order
if (amount === '0') return null
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus: fix for this issue I observed while testing.

The order would match but still be in the pending list.
This prevent from quoting it and getting unnecessary 400s.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, thanks

Comment on lines +266 to +267
appData: order.appData ?? undefined,
appDataHash: order.appDataHash ?? undefined,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus: pass the original appData so we can get more precise quotes.
It could have for example the permit hook, which affects the fee price.

const pendingLimit = useOnlyPendingOrders(chainId, UiOrderType.LIMIT)
const pendingTwap = useOnlyPendingOrders(chainId, UiOrderType.TWAP)
const pending = useMemo(() => pendingLimit.concat(pendingTwap), [pendingLimit, pendingTwap])
const pending = useOnlyPendingOrders(chainId)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We stopped checking for SWAPs since the preparation for TWAP.
This change checks for all order types once again, since we need the indication for all pending orders.

@alfetopito alfetopito self-assigned this Jan 5, 2024
@alfetopito alfetopito requested review from elena-zh and a team January 5, 2024 17:28
Copy link
Contributor

@anxolin anxolin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks great. It would be nice if someone, like Elena can test it

Copy link

@elena-zh elena-zh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, works!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No 'Price out of market' message
4 participants