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

feat: add mu03 support #99

Merged
merged 10 commits into from
Sep 12, 2023
Merged

feat: add mu03 support #99

merged 10 commits into from
Sep 12, 2023

Conversation

denviljclarke
Copy link
Contributor

@denviljclarke denviljclarke commented Sep 4, 2023

Description

This PR adds support for MU03 changes, it also lays the groundwork to make future stable additions more scaleable. The main changes are:

  • axlEUROC has been added
  • The exchanges have been updated based on the config produced by the Mento SDK.
  • The token selection validation logic updated to a more scalable solution. Instead of relying on a case-by-case custom validation, the new approach is based on the exchange configuration to check if pairs are swappable. This will ensure greater flexibility and scalability for future changes.

The deployed preview for this branch can be viewed here

Other changes

Token outputs are now limited to valid options, only showing users valid options. When a token is selected only the list of token which are valid to swap are shown instead of showing invalid options and programatically changing their selections.

I noticed unwanted behaviour when connected to a non Celo network, so I added non Celo network detection as part of logic which handles enabling and disabling of swap button.

Tested

I performed the regression tests to confirm core functionality still works
I also selected selected each token as input to ensured only swappable outputs were displayed

Related issues

Checklist before requesting a review

  • I have performed a self-review of my own code
  • I have added tests that prove my fix is effective or that my feature works
  • The PR title follows the conventions
  • I have run the regression tests

@denviljclarke denviljclarke self-assigned this Sep 4, 2023
@vercel
Copy link

vercel bot commented Sep 4, 2023

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

Name Status Preview Comments Updated (UTC)
mento-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 8, 2023 3:16am

Copy link

@ninabarbakadze ninabarbakadze left a comment

Choose a reason for hiding this comment

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

some questions. also, wondering how compatible this would be with the recent changes I made to swapForm


return tokensForChain
? Object.entries(tokensForChain)
.filter(([, tokenAddress]) => tokenAddress !== '') // Allows incomplete 'TokenAddresses' list i.e When tokens are not on all chains

Choose a reason for hiding this comment

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

we should probably not allow incomplete tokenAddresses right

Copy link
Contributor Author

Choose a reason for hiding this comment

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

tokenAddresses (the token list which is used to populate the UI) isn't incomplete. The TokenAddress token to chain map above is incomplete (as there's no EUROC on main net). This is what allows us to move forward and add tokens for a chain without requiring it on all chains

src/features/swap/SwapForm.tsx Outdated Show resolved Hide resolved
@denviljclarke
Copy link
Contributor Author

some questions. also, wondering how compatible this would be with the recent changes I made to swapForm

There may be some conflict in the submit button, but I've updated the onClick assignment logic to make it easy to add your additional logic as I think this may be merged first so we can use the UI for MU03 testing

Copy link
Member

@bayological bayological left a comment

Choose a reason for hiding this comment

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

Let's refactor to use the SDK method getTradeablePairs to avoid hardcoding these things

@denviljclarke
Copy link
Contributor Author

Let's refactor to use the SDK method getTradeablePairs to avoid hardcoding these things

I agree, but this change will require a bit more time. We can merge this and I'll create another issue for full SDK integration.

@nvtaveras nvtaveras merged commit 358bcd8 into main Sep 12, 2023
6 checks passed
@nvtaveras nvtaveras deleted the feat/MU03_support branch September 12, 2023 15:18
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.

UI support for MU03 on test nets
4 participants