From a60a14b634be338bf608dcbd4e2c2b85b85469c7 Mon Sep 17 00:00:00 2001 From: Nicholas Smith Date: Thu, 31 Oct 2024 12:35:41 -0500 Subject: [PATCH] chore(feedback): remove exchange rate calc not needed --- .../src/AssetsContractController.ts | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/assets-controllers/src/AssetsContractController.ts b/packages/assets-controllers/src/AssetsContractController.ts index ed2532c120d..082219a8cdf 100644 --- a/packages/assets-controllers/src/AssetsContractController.ts +++ b/packages/assets-controllers/src/AssetsContractController.ts @@ -750,22 +750,11 @@ export class AssetsContractController { try { const contract = new Contract(contractAddress, abi, provider); - const exchangeRateDenominator = BigNumber.from((1e18).toString()); - const multiplier = exchangeRateDenominator; const userShares = await contract.getShares(address); // convert shares to assets only if address shares > 0 else return default balance if (!userShares.lte(0)) { - const exchangeRateNumerator = await contract.convertToAssets( - exchangeRateDenominator, - ); - const exchangeRate = exchangeRateNumerator - .mul(multiplier) - .div(exchangeRateDenominator); - - const userAssets = userShares.mul(exchangeRate).div(multiplier); - - balance = userAssets; + balance = await contract.convertToAssets(userShares.toString()); } } catch (error) { // if we get an error, log and return the default value