Skip to content
New issue

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

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

Already on GitHub? # to your account

fix: Add MANTLE support for conversion rates #5402

Merged

Conversation

Prithpal-Sooriya
Copy link
Contributor

@Prithpal-Sooriya Prithpal-Sooriya commented Feb 26, 2025

Explanation

It seems that the MANTLE ERC20 tokens have wildly different USD/fiat conversions that what we had expected. This is amplified if you have more tokens.

Doing some digging, it seems that the balance/market data calculation is processed in the fetchAndMapExchangeRatesForUnsupportedNativeCurrency flow (for unsupported currencies).

Code Flow

Starts here...
Which calls this
Which is a renamed export of fetchExchangeRate which doesn't use that conversion

Inspecting extension network shows that we fetch the conversion rate using this URL:
https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=MNT

This is incorrect as it is not using the correct symbol override. The url should be:
https://min-api.cryptocompare.com/data/price?fsym=ETH&tsyms=MANTLE

This gives a much better unsupported conversion number that what it currently is.

References

Changelog

@metamask/assets-controllers

  • FIXED: update crypto-compare-service fetchExchangeRate to allow symbol overrides for mantle.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@salimtb
Copy link
Contributor

salimtb commented Feb 27, 2025

can you update and complete the PR description pls

@Prithpal-Sooriya Prithpal-Sooriya force-pushed the fix/add-improved-token-rates-for-unsupported-tokens branch from 63c775d to 85eb612 Compare February 27, 2025 10:44
@Prithpal-Sooriya Prithpal-Sooriya marked this pull request as ready for review February 27, 2025 10:45
@Prithpal-Sooriya Prithpal-Sooriya requested a review from a team as a code owner February 27, 2025 10:45
@Prithpal-Sooriya Prithpal-Sooriya enabled auto-merge (squash) February 27, 2025 10:50
@Prithpal-Sooriya Prithpal-Sooriya merged commit 1a56814 into main Feb 27, 2025
136 checks passed
@Prithpal-Sooriya Prithpal-Sooriya deleted the fix/add-improved-token-rates-for-unsupported-tokens branch February 27, 2025 10:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants