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

WT-1753 Factor in balance requirement for swap route and when getting amount to bridge for bridge to swap route #938

Merged
merged 12 commits into from
Oct 5, 2023

Conversation

imx-mikhala
Copy link
Contributor

@imx-mikhala imx-mikhala commented Oct 4, 2023

Summary

This PR ensures we are properly factoring in the balance requirements (the amounts needed of imx and erc20s to perform the action) when trying to swap and when trying to do a bridge->swap

The swap has been updated to check the balance requirements before doing a swap to ensure the user has enough balance to cover both the amount to be swapped and the balance requirement.

The bridge->swap has been updated when constructing the amount to bridge. This now ensures if we have a balance requirement for the token we are also trying to bridge->swap that the amount bridged over covers enough to handle both swapping the amount and the balance requirement.

  • The logic in the bridge->swap was previously just bridging across also the balance requirement amount, but this would likely ask the user to bridge way too much across unnecessarily and the new logic figures out actual required amounts

@imx-mikhala imx-mikhala requested a review from a team as a code owner October 4, 2023 22:48
@imx-mikhala imx-mikhala changed the title WT-1753 WT-1753 Factor in balance requirement for swap route and when getting amount to bridge for bridge to swap route Oct 4, 2023
Copy link
Contributor

@dreamoftrees dreamoftrees left a comment

Choose a reason for hiding this comment

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

Awesome work @imx-mikhala 👍 🌮

@imx-mikhala imx-mikhala merged commit c8ac992 into main Oct 5, 2023
6 checks passed
@imx-mikhala imx-mikhala deleted the swap-patch branch October 5, 2023 04:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants