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: wrong usd price of dot coin in purchase cart #6965

Merged
merged 2 commits into from
Aug 28, 2023

Conversation

xiiiAtCn
Copy link
Contributor

@xiiiAtCn xiiiAtCn commented Aug 26, 2023

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Optional

Did your issue had any of the "$" label on it?

My DOT address: Payout

Community participation

Screenshot 📸

shot

Copilot Summary

🤖 Generated by Copilot at cf06fe5

Improved token decimal handling in shoppingCart component. Used getChainProperties function to convert token prices and royalties to USD in components/common/shoppingCart/utils.ts.

🤖 Generated by Copilot at cf06fe5

Sing, O Muse, of the skillful coder who refined
the shopping cart component with a clever mind.
He imported a function to get the chain properties
of tokens, and converted their prices and royalties.

@kodabot
Copy link
Collaborator

kodabot commented Aug 26, 2023

SUCCESS @xiiiAtCn PR for issue #6943 which is assigned to you. Please wait for review and don't hesitate to grab another issue in the meantime!

@netlify
Copy link

netlify bot commented Aug 26, 2023

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 7f691e7
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/64ec75300507dc0008ad6c62
😎 Deploy Preview https://deploy-preview-6965--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kodabot
Copy link
Collaborator

kodabot commented Aug 26, 2023

WARNING @xiiiAtCn PR for issue #6961 which isn't assigned to you. Please be warned that this PR may get rejected if there's another assignee for issue #6961

@reviewpad
Copy link
Contributor

reviewpad bot commented Aug 26, 2023

AI-Generated Summary: This pull request introduces a fix for an issue related to the display of USD prices of DOT coin in the shopping cart. Prior to this fix, the utility function totalPriceUsd had hardcoded a set decimal place for processing prices, which caused incorrect USD conversion for the DOT coin given its different token decimals. This patch resolves this issue by dynamically determining the decimal places based on the specific token being processed. A helper function getTokenDecimal was added to help achieve this. This function takes a ShoppingCartItem as its input, retrieves its associated token from a lookup object, then retrieves the decimal places using configuration data from a chain configuration list. The token decimal obtained is then used in totalPriceUsd in place of the previously hardcoded value, ensuring accurate USD pricing for all tokens. The change has been applied to both the calculation of total price and the royalties amount.

@codeclimate
Copy link

codeclimate bot commented Aug 26, 2023

Code Climate has analyzed commit cf06fe5 and detected 0 issues on this pull request.

View more on Code Climate.

@reviewpad reviewpad bot added the small Pull request is small label Aug 26, 2023
@xiiiAtCn xiiiAtCn marked this pull request as ready for review August 26, 2023 11:00
@xiiiAtCn xiiiAtCn requested a review from a team as a code owner August 26, 2023 11:00
@xiiiAtCn xiiiAtCn requested review from preschian and Jarsen136 and removed request for a team August 26, 2023 11:00
@Jarsen136 Jarsen136 requested a review from prury August 26, 2023 12:45
@prury prury added the S-works-for-me-✅ qa-guild has tested PR from end user perspective and functionality worked label Aug 26, 2023
Copy link
Contributor

@daiagi daiagi left a comment

Choose a reason for hiding this comment

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

wfm

components/common/shoppingCart/utils.ts Outdated Show resolved Hide resolved
Copy link
Contributor

@stephenjason89 stephenjason89 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

Co-authored-by: Luke Fishman <daiagi@gmail.com>
@yangwao
Copy link
Member

yangwao commented Aug 28, 2023

pay 30 usd

@yangwao yangwao merged commit 8c64066 into kodadot:main Aug 28, 2023
@yangwao
Copy link
Member

yangwao commented Aug 28, 2023

😍 Perfect, I’ve sent the payout
💵 $30 @ 4.44 USD/DOT ~ 6.757 $DOT
🧗 12jXHf7yYF4wTRjDPbwFB24V1nVRPRkuU2S8Ke5ZWTfvyBGW
🔗 0xa7098f08c02295f7ad0a70f30af59a7437d91da886f432023bbffe64f4364135

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao added the paid pull-request has been paid label Aug 28, 2023
@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@xiiiAtCn xiiiAtCn deleted the fix/issue-6943 branch August 30, 2023 09:56
This was referenced Aug 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paid pull-request has been paid S-works-for-me-✅ qa-guild has tested PR from end user perspective and functionality worked small Pull request is small
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong Price in items explorer Not calculating usd total amount in confirmation modal
8 participants