Skip to content

Commit

Permalink
fix testing and rename for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
godismercilex committed Nov 21, 2023
1 parent da4ae2a commit ed6ca78
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion x/perp/v2/keeper/clearing_house.go
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ func (k Keeper) transferFee(
return sdkmath.Int{}, err
}

exchangeFeeRatio, err = k.applyDiscount(ctx, pair, trader, positionNotional, exchangeFeeRatio)
exchangeFeeRatio, err = k.calculateDiscount(ctx, pair, trader, positionNotional, exchangeFeeRatio)
if err != nil {
return sdkmath.Int{}, err
}
Expand Down
4 changes: 2 additions & 2 deletions x/perp/v2/keeper/dnr.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ func (k Keeper) GetTraderDiscount(ctx sdk.Context, trader sdk.AccAddress, volume
return math.LegacyZeroDec(), false
}

// applyDiscount applies the discount and rebate to the given exchange fee ratio.
// calculateDiscount applies the discount and rebate to the given exchange fee ratio.
// It updates the current epoch trader volume.
// It returns the new exchange fee ratio.
func (k Keeper) applyDiscount(
func (k Keeper) calculateDiscount(
ctx sdk.Context,
_ asset.Pair,
trader sdk.AccAddress,
Expand Down
4 changes: 2 additions & 2 deletions x/perp/v2/keeper/dnr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ func TestRebates(t *testing.T) {
SetBlockNumber(1),
SetBlockTime(startBlockTime),

FundAccount(alice, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, positionSize.AddRaw(100_000)))),
FundAccount(bob, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, positionSize.AddRaw(100_000)))),
FundAccount(alice, sdk.NewCoins(sdk.NewCoin(types.TestingCollateralDenomNUSD, positionSize.AddRaw(100_000)))),
FundAccount(bob, sdk.NewCoins(sdk.NewCoin(types.TestingCollateralDenomNUSD, positionSize.AddRaw(100_000)))),
FundModule(types.PerpEFModuleAccount, sdk.NewCoins(sdk.NewCoin(denoms.NUSD, sdk.NewInt(100_000_000)))),
).
When(
Expand Down

0 comments on commit ed6ca78

Please sign in to comment.