Skip to content

Commit

Permalink
chore(feedback): remove exchange rate calc not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
nickewansmith committed Oct 31, 2024
1 parent 4d90470 commit a60a14b
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions packages/assets-controllers/src/AssetsContractController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a60a14b

Please sign in to comment.