From 5b6e524c901ce23e838f56e4b11e8c57552380b9 Mon Sep 17 00:00:00 2001 From: Dan J Miller Date: Tue, 19 Jan 2021 13:35:58 -0330 Subject: [PATCH] Remove default to 18 decimals in quotesToRenderableData method (#10212) --- ui/app/pages/swaps/swaps.util.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/ui/app/pages/swaps/swaps.util.js b/ui/app/pages/swaps/swaps.util.js index 81876d947..0fcc5d8a2 100644 --- a/ui/app/pages/swaps/swaps.util.js +++ b/ui/app/pages/swaps/swaps.util.js @@ -467,11 +467,11 @@ export function quotesToRenderableData( } = quote const sourceValue = calcTokenAmount( sourceAmount, - sourceTokenInfo.decimals || 18, + sourceTokenInfo.decimals, ).toString(10) const destinationValue = calcTokenAmount( destinationAmount, - destinationTokenInfo.decimals || 18, + destinationTokenInfo.decimals, ).toPrecision(8) const { @@ -501,14 +501,11 @@ export function quotesToRenderableData( destinationTokenInfo.symbol === 'ETH' ? calcTokenAmount( destinationAmount, - destinationTokenInfo.decimals || 18, + destinationTokenInfo.decimals, ).minus(rawEthFee, 10) : new BigNumber(tokenConversionRate || 0, 10) .times( - calcTokenAmount( - destinationAmount, - destinationTokenInfo.decimals || 18, - ), + calcTokenAmount(destinationAmount, destinationTokenInfo.decimals), 10, ) .minus(rawEthFee, 10)