Skip to content

Commit

Permalink
SOV-3802: Fix mismatch in collateral on margin trade positions (#2595)
Browse files Browse the repository at this point in the history
Co-authored-by: soulBit <[email protected]>
  • Loading branch information
pietro-maximoff and soulBit authored Mar 4, 2024
1 parent 7f8d2aa commit a7dc5d1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export const AddToMarginDialog: React.FC<IAddToMarginDialogProps> = ({
trade,
loanToken: { id: loanTokenId },
collateralToken: { id: collateralTokenId },
positionSize: positionSizeItem,
} = item;
const entryLeverage = trade?.[0].entryLeverage || DEFAULT_TRADE.entryLeverage;
const positionSizeValue =
trade?.[0].positionSize || DEFAULT_TRADE.positionSize;
const positionSizeValue = positionSizeItem || DEFAULT_TRADE.positionSize;
const tokenDetails = AssetsDictionary.getByTokenContractAddress(
collateralTokenId,
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,11 @@ export const ClosePositionDialog: React.FC<IClosePositionDialogProps> = ({
id,
loanToken: { id: loanTokenId },
collateralToken: { id: collateralTokenId },
positionSize: positionSizeValue,
} = item;

const entryLeverage = trade?.[0].entryLeverage || DEFAULT_TRADE.entryLeverage;
const positionSize = trade?.[0].positionSize || DEFAULT_TRADE.positionSize;
const positionSize = positionSizeValue || DEFAULT_TRADE.positionSize;
const [collateral, setCollateral] = useState(
assetByTokenAddress(collateralTokenId),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,10 @@ export const ClosedPositionRow: React.FC<ClosedPositionRowProps> = ({
collateralToken: { id: collateralTokenId },
liquidates,
closeWithSwaps,
positionSize: positionSizeValue,
} = event;
const entryLeverage = trade?.[0].entryLeverage || DEFAULT_TRADE.entryLeverage;
const positionSize = trade?.[0].positionSize || DEFAULT_TRADE.positionSize;
const positionSize = positionSizeValue || DEFAULT_TRADE.positionSize;
const entryPrice = trade?.[0].entryPrice || DEFAULT_TRADE.entryPrice;
const transaction = trade?.[0].transaction.id || DEFAULT_TRADE.transactionId;
const loanAsset = assetByTokenAddress(loanTokenId);
Expand Down

0 comments on commit a7dc5d1

Please sign in to comment.