Skip to content

Commit

Permalink
fix: check if discount nil
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-vagabond committed Nov 25, 2023
1 parent 5a98d93 commit 221379a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions x/amm/keeper/apply_discount.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ import (

// ApplyDiscount applies discount to swap fee if applicable
func (k Keeper) ApplyDiscount(ctx sdk.Context, swapFee sdk.Dec, discount sdk.Dec, sender string) (sdk.Dec, sdk.Dec, error) {
// if discount is nil, return swap fee and zero discount
if discount.IsNil() {
return swapFee, sdk.ZeroDec(), nil
}

// if discount is zero, return swap fee and zero discount
if discount.IsZero() {
return swapFee, sdk.ZeroDec(), nil
}
Expand Down

0 comments on commit 221379a

Please sign in to comment.