-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix: fix volume calculation in asset details page #24331
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
base: main
Are you sure you want to change the base?
Conversation
|
CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes. |
| locale: i18n.locale, | ||
| currentCurrency, | ||
| isEvmAssetSelected: !isNonEvmAsset, | ||
| isNativeAsset: !isNonEvmAsset && Boolean(asset.isNative || asset.isETH), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this assertion is true:
isNativeAsset: !isNonEvmAsset && Boolean(asset.isNative || asset.isETH),
The name is isNativeAsset and you are saying that only !isNonEvmAsset can be native, what about nonEVMAssets?
I would have kept the property isEvmAssetSelected and added a new property called isNativeAsset equal to Boolean(asset.isNative || asset.isETH)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like a naming confusing issue ^^"
The current code:
isNativeAsset: !isNonEvmAsset && Boolean(asset.isNative || asset.isETH)
Actually means: "Is this an EVM native asset that needs conversion?"
But the name suggests: "Is this any native asset?" (which would include SOL)
I can refactor this and keep isEvmAssetSelected
Non evm prices come from the snap and should already come in user's currency
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24331 +/- ##
===========================================
- Coverage 79.28% 69.17% -10.11%
===========================================
Files 4065 4066 +1
Lines 107173 107260 +87
Branches 21830 21860 +30
===========================================
- Hits 84971 74202 -10769
- Misses 16248 27442 +11194
+ Partials 5954 5616 -338 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🔍 Smart E2E Test Selection
click to see 🤖 AI reasoning detailsThe changes modify the TokenDetails component and marketDetails utility function, which are responsible for displaying market data (market cap, volume, all-time high/low, fully diluted market cap) for tokens in the Asset Overview screen. Key changes:
The changes are well-scoped to the asset display functionality and have comprehensive unit test coverage. The risk is medium because:
SmokeAssets is the appropriate tag as it covers "Asset management and display, NFTs, token details" which directly matches the TokenDetails component being modified. |
|



Description
Total volume was displaying incorrect values for ERC20 tokens on EVM chains.
Example:
Raw totalVolume from API: 587,265 (already in USD)
Displayed value: $1.8B (incorrectly multiplied by ETH conversion rate ~$3,087)
Expected value: ~$587K
The
formatMarketDetailsfunction was multiplying all market data values by conversionRate for all EVM assets (isEvmAssetSelected). However:Native assets (ETH): API returns market data in native units → conversion needed
ERC20 tokens: API returns market data already in fiat (vsCurrency) → no conversion needed
Changelog
CHANGELOG entry: Fixed a bug where total volume was displaying the wrong value in asset details page
Related issues
Fixes:
Manual testing steps
Screenshots/Recordings
Before
After
Pre-merge author checklist
Pre-merge reviewer checklist
Note
Fixes incorrect fiat values in market details by applying conversion only when needed.
formatMarketDetailsto acceptneedsConversionand optionalconversionRate, applying a multiplier only for cached EVM data; leaves API-fetched (fiat) data unchangedTokenDetails.tsxto computeneedsConversionbased on cache source and network, simplifyconversionRateselection, and pass new options intoformatMarketDetailsMarketDetailsList.test.tsxandTokenDetails.test.tsxWritten by Cursor Bugbot for commit c85ae41. This will update automatically on new commits. Configure here.