Skip to content

Commit

Permalink
Fix IsIsolatedPerpetual function orientation
Browse files Browse the repository at this point in the history
Signed-off-by: Shrenuj Bansal <shrenuj@dydx.exchange>
  • Loading branch information
shrenujb committed Apr 23, 2024
1 parent 30b926d commit a94c952
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
8 changes: 6 additions & 2 deletions protocol/x/perpetuals/keeper/perpetual.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,12 @@ import (
)

func (k Keeper) IsIsolatedPerpetual(ctx sdk.Context, perpetualId uint32) (bool, error) {
insuranceFundName, err := k.GetInsuranceFundName(ctx, perpetualId)
return insuranceFundName == types.InsuranceFundName, err
perpetual, err := k.GetPerpetual(ctx, perpetualId)
if err != nil {
return false, err
}

return perpetual.Params.MarketType == types.PerpetualMarketType_PERPETUAL_MARKET_TYPE_ISOLATED, nil
}

// GetInsuranceFundName returns the name of the insurance fund account for a given perpetual.
Expand Down
4 changes: 2 additions & 2 deletions protocol/x/subaccounts/keeper/negative_tnc_subaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ func (k Keeper) getNegativeTncSubaccountStoreSuffix(
return "", err
}
if isIsolated {
return types.CrossCollateralSuffix, nil
} else {
return lib.UintToString(perpetualId), nil
} else {
return types.CrossCollateralSuffix, nil
}
}

Expand Down

0 comments on commit a94c952

Please sign in to comment.