Skip to content

Commit

Permalink
update getAdjustedSum logic
Browse files Browse the repository at this point in the history
  • Loading branch information
xieqiancaosissi committed Dec 31, 2023
1 parent bd6be3f commit 52fd165
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions redux/selectors/getWithdrawMaxAmount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ export const getAdjustedSum = (
const positionData = portfolio.positions[positionId][type][id];
let pricedBalance;
if (asset?.isLpToken) {
const assetSuppliedBorrow = asset[type === "collateral" ? "supplied" : "borrowed"];
const lpTokensBalance = new Decimal(assetSuppliedBorrow.balance)
.mul(positionData.shares)
.div(assetSuppliedBorrow.shares)
.round();
// const assetSuppliedBorrow = asset[type === "collateral" ? "supplied" : "borrowed"];
// const lpTokensBalance = new Decimal(assetSuppliedBorrow.balance)
// .mul(positionData.shares)
// .div(assetSuppliedBorrow.shares)
// .round();
const lpTokensBalance = new Decimal(positionData.balance).round();
const unitShare = new Decimal(10).pow(asset.metadata.decimals);
pricedBalance = asset.metadata.tokens.reduce((sum, tokenValue) => {
const tokenAsset = assets[tokenValue.token_id];
Expand Down

0 comments on commit 52fd165

Please sign in to comment.