Skip to content
This repository has been archived by the owner on Jan 24, 2024. It is now read-only.

Commit

Permalink
feat(gmx): Add size and leverage to perp display props (#2852)
Browse files Browse the repository at this point in the history
  • Loading branch information
wpoulin committed Jul 30, 2023
1 parent eba0bc0 commit 9b6836f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/apps/gmx/common/gmx.perp.contract-position-fetcher.ts
Expand Up @@ -128,6 +128,7 @@ export abstract class GmxPerpContractPositionFetcher extends CustomContractPosit

const [collateralToken, indexToken, usdcToken] = contractPosition.tokens;
const isLong = contractPosition.dataProps.isLong;
const positionKey = contractPosition.dataProps.positionKey;

const position = await contract.getPosition(address, collateralToken.address, indexToken.address, isLong);
// non existing position returns size and collateral = 0
Expand Down Expand Up @@ -162,7 +163,16 @@ export abstract class GmxPerpContractPositionFetcher extends CustomContractPosit
leverage: Number(leverage),
};

const displayProps = {
...contractPosition.displayProps,
isLong,
positionKey,
size,
leverage,
};

contractPosition.dataProps = dataProps;
contractPosition.displayProps = displayProps;

const allTokens = contractPosition.tokens.map((cp, idx) =>
drillBalance(cp, balancesRaw[idx]?.toString() ?? '0', { isDebt: cp.metaType === MetaType.BORROWED }),
Expand Down

0 comments on commit 9b6836f

Please sign in to comment.