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

Resolve rate from coinGecko if exchange rate is not found #1291

Merged
merged 7 commits into from
Aug 24, 2022

Conversation

Xiaolei-Shawn
Copy link
Contributor

@Xiaolei-Shawn Xiaolei-Shawn commented Aug 17, 2022

Description

  • Resolve currency rate from coinGecko if its key is not found in exchangeRates.
  • Fix a bug when calculating exchange rate that base and quote currency key are passed to function newGetExchangeRatesForCurrencies with wrong order:
    () => newGetExchangeRatesForCurrencies(exchangeRates, quoteCurrencyKey, baseCurrencyKey),

After the fix, we should use rate but inverseRate to render title in exchange page

Related issue

Issue

Motivation and Context

The title in exchange won't show correct rate if one or both currencies are not found in exchange rates results.

How Has This Been Tested?

  • Go to Exchange view
  • Select sINR and DAI
  • Tab title in browser should show correct exchange rate
  • Switch currency to see title change

Screenshots (if appropriate):

image
image

@vercel
Copy link

vercel bot commented Aug 17, 2022

@Xiaolei-Shawn is attempting to deploy a commit to the Kwenta Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Aug 17, 2022

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

Name Status Preview Updated
kwenta ✅ Ready (Inspect) Visit Preview Aug 23, 2022 at 10:30PM (UTC)

@vercel vercel bot temporarily deployed to Preview August 17, 2022 22:33 Inactive
@platschi platschi self-requested a review August 17, 2022 22:35
@platschi
Copy link
Collaborator

@Xiaolei-Shawn Kindly check lint errors :)

@Xiaolei-Shawn
Copy link
Contributor Author

Xiaolei-Shawn commented Aug 18, 2022

@Xiaolei-Shawn Kindly check lint errors :)

My bad! Fixed already. @platschi

@vercel vercel bot temporarily deployed to Preview August 18, 2022 13:05 Inactive
@LeifuChen
Copy link
Contributor

@Xiaolei-Shawn
I think the function signature is ordered like this by some reason. The rate on title has been fixed but it caused the issue for the calculation of the received amount.
image

pages/exchange.tsx Outdated Show resolved Hide resolved
@vercel vercel bot temporarily deployed to Preview August 18, 2022 19:11 Inactive
@LeifuChen
Copy link
Contributor

@Xiaolei-Shawn The rate of synthetic assets (the assets with the prefix s, which is fetching the price from rate not via coincgecko api) is not working now.
image

@vercel vercel bot temporarily deployed to Preview August 19, 2022 18:22 Inactive
@vercel vercel bot temporarily deployed to Preview August 23, 2022 22:30 Inactive
Copy link
Contributor

@LeifuChen LeifuChen left a comment

Choose a reason for hiding this comment

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

Looks good to me.

Copy link
Collaborator

@platschi platschi left a comment

Choose a reason for hiding this comment

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

Perfect, works as expected.

@platschi platschi merged commit f9ef2c2 into Kwenta:dev Aug 24, 2022
@KngZhi KngZhi mentioned this pull request Oct 5, 2022
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.

3 participants