Skip to content

Commit e982f21

Browse files
committed
sdk: avoid undefined for liqudiationBuffer in getTotalCollateral
1 parent 1022c9f commit e982f21

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sdk/src/user.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ export class User {
876876
.div(new BN(SPOT_MARKET_WEIGHT_PRECISION));
877877
}
878878

879-
if (positionUnrealizedPnl.lt(ZERO)) {
879+
if (liquidationBuffer && positionUnrealizedPnl.lt(ZERO)) {
880880
positionUnrealizedPnl = positionUnrealizedPnl.add(
881881
positionUnrealizedPnl.mul(liquidationBuffer).div(MARGIN_PRECISION)
882882
);

0 commit comments

Comments
 (0)